Skip to main content
Glama

Group-by aggregation over an open-data dataset

aggregate_dataset
Read-only

Group 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

NameRequiredDescriptionDefault
idNoDataset ID (slug): the 'id' of a search_datasets hit
opNoAggregation (default count)count
langNoLanguage for titles/descriptions: de, fr, it or en (default en; falls back to de)
limitNoMax groups returned (default 50)
orderNoSort groups by value desc (default), asc, or by group keydesc
whereNoColumn filters: {column: value}. Exact (case-insensitive) match; prefix '~' for substring, '>'/'<' for numeric compare, e.g. {"Kanton": "ZH", "Jahr": ">2019"}
formatNoPreferred resource format (overrides the CSV-first default)
portalNoCatalogue: '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)
searchNoCase-insensitive substring pre-filter across all fields
group_byNo0–2 column names to group by (omit for one overall total)
resourceNoOptional resource selector: 0-based index from get_dataset, resource id, or part of its title. Default: best CSV > JSON > GeoJSON
resource_urlNoAlternatively, 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_columnNoNumeric column to aggregate (required for sum/avg/min/max)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.3

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds genuinely non-obvious behavior: Swiss-style numeric formatting (1'234.5) is parsed, and the worked examples show filter/order semantics in situ. It does not describe the returned shape or how limit truncation appears.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core behavior is stated up front in the first clause, followed by a one-line rationale and three compact example payloads. No sentence restates the tool name or wastes space; the examples earn their length by encoding several parameter interactions at once.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter tool with no output schema, the description covers intent, filters, ordering and worked calls well. The remaining gap is the return shape (group keys plus aggregated values, and what limit truncation looks like), which the agent must infer from the limit parameter.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; the description exceeds it by showing three full example payloads that demonstrate how group_by, op, value_column, where and order compose in practice. It also reinforces that value_column must be numeric and that Swiss-formatted values are parsed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific operation and shape: group a dataset's rows by one or two columns and compute count/sum/avg/min/max over a numeric column. That aggregation semantics inherently separates it from row-level query tools, though no sibling (e.g. query_dataset) is named explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete motivating cases (total population per canton, average rent per year) and notes that filters can be applied via where/search before aggregating. It does not state when to prefer a row-level query tool or when an aggregation is inappropriate, so routing is implied rather than explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools