Aggregate
aggregateTotals, counts, averages, min and max, optionally grouped. Metrics: count, count_distinct, sum, avg, min, max, or { metric: name } for one of the team's approved definitions (describe_dataset lists them). order_by may use group columns or metric names. where, group_by and metrics may use columns of linked datasets as alias.column (see describe_dataset links). sum, avg and count of a linked column count each linked row once per group (a customer's credit limit once, however many orders), so revenue and target by country can come from one call.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"dataset_id": "<dataset_id>"
},
"name": "aggregate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| grain | No | Group date and timestamp columns in group_by by this period (week starts Monday); each group is labelled with the period's first day | |
| limit | No | ||
| where | No | ||
| offset | No | ||
| metrics | No | ||
| version | No | The dataset version from an earlier result's meta (or one listed in describe_dataset's versions). Pass it when you chain calls (distinct_values, then aggregate): the answer stays on that version even if the data was refreshed in between (meta then has stale: true and current_version). If that version is no longer kept, the call fails with source_changed. | |
| group_by | No | ||
| order_by | No | ||
| dataset_id | Yes | Dataset id from list_datasets, e.g. ds_ab12cd34ef56 |