Group by and aggregate
group_byAggregate CSV rows by one or more columns and calculate counts, sums, means, min, max, median, or distinct counts. Filter, sort, and limit results for grouped insights.
Instructions
GROUP BY one or more columns with aggregations (count, sum, mean, min, max, median, count_distinct). Sorted by the first metric descending unless 'sort' is given.
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": {
"file": "<file>",
"by": "<by>",
"metrics": "<metrics>"
},
"name": "group_by"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | Yes | ||
| file | Yes | CSV path relative to the allowed directory (CSV_INSIGHTS_DIR), e.g. 'sales/2026-q3.csv' | |
| sort | No | ||
| limit | No | ||
| where | No | Row filters, all must match (AND) | |
| metrics | Yes |