Skip to main content
Glama

aggregate

Compute a grouped aggregate over one topic — the aggregation-first path. agg is one of avg/sum/min/max/count/weighted_rate; metric is a metric column (DEFAULTS to the topic key_metric; ignored for count); group_by is a list of grain columns (year, FK codes like district_code or county_fips, or categoricals — see describe_dataset). weighted_rate computes a true population-weighted SUM(numerator)/SUM(denominator) for a rate key metric (when the contract declares the components) — prefer it over avg for a rate across multiple places/years, since avg means the per-row rates and ignores population. With metric set to a column the topic's pooled_rates lists (a zone's people per square mile), it pools that rate's own declared numerator and denominator (SUM(people) / SUM(land area)) over rows carrying both. Supports the same filters / year / year_min-year_max / detail as query_dataset, plus order_by+order for top-N (order_by 'value' for the aggregated column; NULL cells sort LAST in either direction). Returns one small row per group with <metric>_<agg> (or row_count) plus coverage diagnostics (input_rows / non-null counts) so suppression is visible; aggregation_scope flags whether rows are source-published at this grain or recomputed from a finer detail (prefer source-published — see the advisory). A sum/weighted_rate ACROSS a column the contract declares non_additive (overlapping rows, e.g. county rows that count one application in several counties) still returns, but carries a top-level non_additive block and a leading non_additive_sum advisory: that figure is NOT a total — group_by the column or use the published total row instead. Aggregates SKIP NULLs and NULL means SUPPRESSED not zero. No raw SQL: all identifiers are contract-allowlisted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aggNoavg
yearNo
limitNo
orderNoasc
topicYes
detailNo
metricNo
offsetNo
filtersNo
group_byNo
order_byNo
year_maxNo
year_minNo
main_topicNoeducation

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so thoroughly: NULLs are skipped and NULL means SUPPRESSED not zero, aggregation_scope discloses source-published vs recomputed grains, a non_additive block and non_additive_sum advisory are emitted, coverage diagnostics expose suppression, and identifiers are contract-allowlisted (no raw SQL). This is well beyond what the schema conveys.

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

Conciseness4/5

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

Front-loads the core purpose before diving into agg/metric/group_by semantics, and every clause is substantive rather than filler. It is dense with stacked parentheticals, so a small readability cost, but no sentence is wasted.

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?

An output schema exists, so return values need not be described, yet the description usefully doubles down on return shape and suppression caveats. For a 14-parameter tool at 0% schema coverage it is nearly complete, with only offset and main_topic left unexplained.

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 description coverage is 0% across 14 parameters, so the description must compensate, and it largely does: it enumerates valid agg values, explains metric's key_metric default and its count behavior, defines group_by column types, maps filters/year/year_min-year_max/detail to query_dataset, and describes order_by/order plus top-N semantics. offset and main_topic (odd default 'education') are never mentioned, leaving two parameters undocumented.

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

Purpose5/5

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

States a specific verb and resource ('Compute a grouped aggregate over one topic') and positions itself as 'the aggregation-first path', which distinguishes it from the row-returning sibling query_dataset. An agent can tell what this does and which path it represents without opening the schema.

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?

Gives real routing guidance: prefer weighted_rate over avg for a rate across multiple places/years, prefer source-published grains, and group_by the column (or use the published total row) instead of summing a non_additive column. It also names the describe_dataset/query_dataset adjacents. It stops short of an explicit 'use this instead of query_dataset when...' exclusion statement.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources