Skip to main content
Glama

Aggregate any dataset

summarize_dataset
Read-onlyIdempotent

Aggregate city open data by up to three fields to answer questions like 'how many 311 requests per type in ZIP 28205?' Returns counts, sums, averages, or min/max, sorted largest first.

Instructions

Count or aggregate any portal dataset server-side, grouped by up to three fields.

Answers questions like "how many 311 requests of each type were made in ZIP 28205?". Rows are sorted by the statistic, largest first, in a column named stat_value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nearNoOptional street address or 'latitude,longitude'; when given, only records within radius_miles of it are returned.
limitNoMaximum groups to return.
whereNo1=1
group_byYesFields to group by.
layer_urlYesArcGIS layer URL from search_datasets, ending in /MapServer/<n> or /FeatureServer/<n>.
radius_milesNoUsed with near.
statistic_typeNocount
statistic_fieldNoNumeric field to aggregate; required unless counting.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsYes
notesNo
sourceYes
filtersYesThe SQL where clause that was applied.
group_byYes
locationNo
statisticYes
radius_milesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive and open-world, so safety is covered. The description adds operational context beyond that: aggregation runs server-side, grouping is capped at three fields, and results are sorted by the statistic descending in a stat_value column. It does not mention limits or pagination behavior, but the added context is real.

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?

Three short sentences with the core capability front-loaded, an illustrative example, and the output convention last. No filler or redundant restatement of the name.

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

Completeness3/5

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

For an 8-parameter aggregation tool the description covers purpose and result shape (an output schema exists, so return values needn't be explained), but it leaves filtering (where, near) and statistic selection undocumented and never positions itself against query_dataset or the domain-specific summarize_* siblings.

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

Parameters3/5

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

Schema coverage is 75%, so most parameters are documented structurally, but the description does not compensate for the gaps: where, near/radius_miles, statistic_type, and statistic_field are never explained in prose. The 'grouped by up to three fields' phrase merely restates the schema's maxItems: 3 on group_by.

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?

States a specific verb (count/aggregate) and resource (any portal dataset) with scope qualifiers: server-side, grouped by up to three fields. An agent can distinguish it from row-returning siblings like query_dataset, but no sibling 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 Guidelines3/5

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

The concrete example question ('how many 311 requests of each type were made in ZIP 28205?') implies the class of questions this tool answers, which is useful implied usage. However, there is no explicit when-to-use/when-not guidance and no mention of when to prefer query_dataset or a dedicated sibling like summarize_crime.

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