Group-by aggregation over an open-data dataset
aggregate_datasetGroup dataset rows by one or two columns and calculate count, sum, average, min, or max of a numeric column, with optional filters and sorting, to summarize data by category or time.
Instructions
Group a dataset's rows by one or two columns and compute count, sum, avg, min or max of a numeric column (after optional where/search filters), e.g. total population per canton, average rent per year. Numbers with Swiss formatting (1'234.5) are understood. Examples: {id: '', group_by: ['Kanton'], op: 'sum', value_column: 'Einwohner'}; {id: '', group_by: ['Jahr','Kanton'], op: 'avg', value_column: 'Wert', where: {Jahr: '>2015'}, order: 'group'}; {id: '', group_by: ['Kategorie'], op: 'count'}.
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": "aggregate_dataset"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Dataset ID (slug): the 'id' of a search_datasets hit | |
| op | No | Aggregation (default count) | count |
| lang | No | Language for titles/descriptions: de, fr, it or en (default en; falls back to de) | |
| limit | No | Max groups returned (default 50) | |
| order | No | Sort groups by value desc (default), asc, or by group key | desc |
| where | No | Column filters: {column: value}. Exact (case-insensitive) match; prefix '~' for substring, '>'/'<' for numeric compare, e.g. {"Kanton": "ZH", "Jahr": ">2019"} | |
| format | No | Preferred resource format (overrides the CSV-first default) | |
| portal | No | Catalogue: 'opendata.swiss' (default, national), 'stadt-zuerich' (City of Zürich, data.stadt-zuerich.ch) or 'envidat' (WSL/ETH environmental research data: snow, glaciers, forests, biodiversity, climate) | |
| search | No | Case-insensitive substring pre-filter across all fields | |
| group_by | No | 0–2 column names to group by (omit for one overall total) | |
| resource | No | Optional resource selector: 0-based index from get_dataset, resource id, or part of its title. Default: best CSV > JSON > GeoJSON | |
| resource_url | No | Alternatively, a direct https URL of a CSV/JSON/GeoJSON file (e.g. a download_url from get_dataset). May be disabled on public deployments, prefer 'id' | |
| value_column | No | Numeric column to aggregate (required for sum/avg/min/max) |