compute_aggregates
Main calculation tool for sums, MoM, YoY, shares. Supports cost_centers, accounts, text_query filters. Use for ALL aggregations. Pages losslessly over groups via after_group/next_cursor; use available_range and never claim 'no data' when it shows data. For yearly/quarterly/overall figures set granularity instead of summing months yourself; totals.sum is the total over all periods in scope regardless of granularity. mom/yoy compare with the previous bucket inside the requested window; for the calendar previous month use get_periodic_summaries with include_previous. With group_by=account every sub-account is its own group: the group key carries account, sub_account (null = none) and account_ref ("8400/130" or "8400"). If the user names a cost center (e.g. "Betriebsrat"), call get_cost_center_list FIRST to resolve its number; never guess the number. scope says what the result covers. scope.pnl_reconciled=true means each month was cross-checked against the P&L; a warning then means bookings are missing — pass it on with period, both amounts and the difference. With text_query, cost_centers or categories the result is a subset by design and is not reconciled against the P&L, so never call it provisional or incomplete for that reason. With text_query, scope.text_match gives matched_sum (the result), unfiltered_sum (all bookings of the same accounts, cost centers and months without the search term) and matched_share_pct: name the result together with unfiltered_sum and the share, e.g. 'X € of Y € on these accounts (Z %)'.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "compute_aggregates"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| periods | No | YYYY-MM periods. Also accepts the shorthands 'YYYY' and 'YYYY-Qn' (e.g. '2023', '2023-Q2'), which expand to exactly the months the tenant has data for — prefer them over typing out every month, a forgotten month makes a rollup silently too low. | |
| accounts | No | Account numbers | |
| group_by | No | Grouping dimensions | |
| categories | No | Account categories | |
| operations | No | Metrics to compute (default: ['sum']) | |
| text_query | No | Text filter for customer/vendor names | |
| after_group | No | Pagination cursor: pass pagination.next_cursor from the previous call to fetch the next page of groups | |
| granularity | No | Time bucket of the returned figures: 'month' (default), 'quarter', 'year' or 'total'. Set this whenever the answer needs a figure covering more than one month — never add the monthly values up yourself. | |
| cost_centers | No | Cost center IDs | |
| share_denominator | No |