-
Notifications
You must be signed in to change notification settings - Fork 0
feat(mcp): summarize_orders aggregation tool #41
Copy link
Copy link
Open
Labels
area/clientTouches statuspro_public_api_client/Touches statuspro_public_api_client/area/mcpTouches statuspro_mcp_server/ onlyTouches statuspro_mcp_server/ onlypriority/p2Nice-to-have / bigger featuresNice-to-have / bigger featurestheme/tool-surface-redesignMCP tool surface redesign initiativeMCP tool surface redesign initiative
Metadata
Metadata
Assignees
Labels
area/clientTouches statuspro_public_api_client/Touches statuspro_public_api_client/area/mcpTouches statuspro_mcp_server/ onlyTouches statuspro_mcp_server/ onlypriority/p2Nice-to-have / bigger featuresNice-to-have / bigger featurestheme/tool-surface-redesignMCP tool surface redesign initiativeMCP tool surface redesign initiative
Problem
Reporting workflows — counts by status, age in current status, count of overdue, top-N customers by order count — require paginating
list_ordersper status today and aggregating client-side. For a tenant with thousands of orders this is expensive and slow, and most of the data is thrown away after the count.Proposed shape
A new MCP tool
summarize_ordersthat returns aggregated views:```python
summarize_orders(
group_by: Literal["status", "due_week", "customer", "tag"],
filters: dict | None = None, # same shape as list_orders filters
)
```
Returns counts (and optionally min/max/avg of relevant numeric fields) per group.
Two implementation paths (choice depends on #30 / F3)
Path A — server has an aggregation endpoint
Thin wrapper over the server endpoint. Cheap, fast.
Path B — server doesn't aggregate
Client-side aggregation: paginate
list_ordersfiltering as requested, group in-process, return counts. Add hard caps:Path B is meaningful work and only makes sense if the user actually needs aggregations and Path A isn't coming. If F3 shows the server has nothing planned, this issue may be deferred indefinitely (workflow workaround: agent paginates and groups inline).
Acceptance
group_by="status"(most common ask)Depends on
Tracking
Part of epic #31, Tier 3. Deferrable — only ship after Tier 1 and Tier 2 land.