Skip to main content
Glama

Aggregate

aggregate
Read-onlyIdempotent

Totals, counts, averages, min and max, optionally grouped. Metrics: count, count_distinct, sum, avg, min, max, or { metric: name } for one of the team's approved definitions (describe_dataset lists them). order_by may use group columns or metric names. where, group_by and metrics may use columns of linked datasets as alias.column (see describe_dataset links). sum, avg and count of a linked column count each linked row once per group (a customer's credit limit once, however many orders), so revenue and target by country can come from one call.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "dataset_id": "<dataset_id>"
    },
    "name": "aggregate"
  }
}

Input Schema

NameRequiredDescriptionDefault
grainNoGroup date and timestamp columns in group_by by this period (week starts Monday); each group is labelled with the period's first day
limitNo
whereNo
offsetNo
metricsNo
versionNoThe dataset version from an earlier result's meta (or one listed in describe_dataset's versions). Pass it when you chain calls (distinct_values, then aggregate): the answer stays on that version even if the data was refreshed in between (meta then has stale: true and current_version). If that version is no longer kept, the call fails with source_changed.
group_byNo
order_byNo
dataset_idYesDataset id from list_datasets, e.g. ds_ab12cd34ef56

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already establish that the operation is read-only, idempotent, and non-destructive. The description adds meaningful behavioral context not in annotations, especially that sum, avg, and count over linked columns count each linked row once per group, preventing accidental double counting.

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?

The description is front-loaded with the core aggregation purpose and then adds necessary metric and linked-dataset semantics. It is dense but largely free of repetition, with every sentence contributing useful meaning.

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 9-parameter aggregation tool with no output schema and partial schema coverage, the description covers the most important semantic traps: metric forms, approved definitions, order_by behavior, and linked-column aggregation. Remaining details such as pagination, grain, and version chaining are handled by the schema rather than the description.

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 only 33%, so the description must compensate, and it does so for key parameters: metrics accept fn/column or saved metric names, order_by may use group columns or metric names, and where/group_by/metrics can reference linked dataset columns as alias.column. It does not add much for grain, limit, offset, or version, but those are partly covered by the schema.

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 clearly states that the tool computes totals, counts, averages, min and max, optionally grouped. The purpose is specific and understandable, though it does not explicitly contrast itself with siblings such as query_rows or distinct_values.

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?

Usage is implied by the aggregation purpose and by references to describe_dataset for approved metric definitions and linked dataset columns. However, it gives no explicit when-to-use guidance versus alternatives like query_rows, chart, or distinct_values.

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.