Skip to main content
Glama

stats

Compute summary statistics (count, sum, mean, median, min, max, stddev) for filtered data, with optional group-by support.

Instructions

Aggregate statistics (count, sum, mean, median, min, max, stddev) for one measure across all rows matching filters. Optionally grouped.

Without group_by: returns one stats payload over all matching rows. With group_by: returns per-group stats — much more powerful for "distribution X by Y" queries that would otherwise require N filtered calls.

Examples: # Single aggregate over NSW postcodes stats("IND_POSTCODE_MEDIAN", "median_taxable_income_2022_23", filters={"state": "nsw"}) # → {statistics: {count: 587, mean: 55017, median: 53484, ...}}

# Stats grouped by state — one call instead of 8
stats("IND_POSTCODE_MEDIAN", "median_taxable_income_2022_23",
      group_by="state")
# → {by: "state", groups: [
#     {key: "ACT", statistics: {...}},
#     {key: "NSW", statistics: {...}},
#     ...
# ]}

# Tax payable per income year across the corporate sector
stats("CORP_TRANSPARENCY", "tax_payable", group_by="income_year")

Returns: Without group_by: dict with statistics field. With group_by: dict with by and groups fields; each group carries key, statistics, plus the same envelope metadata (dataset_id, unit, attribution, etc.).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataset_idYesCurated dataset ID. Use search_datasets() / list_curated().
measureYesThe measure key to aggregate over. Use describe_dataset() to see available measures.
filtersNoOptional dimension filters — same shape as get_data.
group_byNoOptional dimension key to partition rows by. When set, returns per-group statistics instead of a single aggregate. Caps at 200 groups to keep responses bounded — exceeding the cap returns the first 200 groups by row order and sets a `groups_truncated` flag in the response.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

No annotations provided. Description details behavior: without group_by returns one stats payload, with group_by returns per-group stats, includes a 200-group cap with a truncation flag, and describes return format clearly.

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?

Description is well-structured with purpose, usage notes, examples, and return format sections. It is concise yet comprehensive, front-loaded with core information.

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

Completeness5/5

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

Given the complexity of a stats tool with optional grouping, the description covers all key behaviors, parameters, and returns. The output schema exists and the description complements it well.

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% with good descriptions. The description adds value beyond schema by clarifying group_by's cap and truncation flag, providing examples, and explaining the output structure.

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?

The description clearly states it aggregates statistics (count, sum, mean, etc.) for one measure across all rows matching filters, optionally grouped. It distinguishes from siblings like get_data (raw data) and search_datasets (dataset search) through examples and usage context.

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?

The description explicitly explains when to use with group_by vs without, and contrasts with needing multiple filtered calls with get_data. It provides examples but does not explicitly state when not to use.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Bigred97/ato-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server