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. Changed2 schema fields changed
    • changedInput schema / properties / metrics / items / properties / where / items / properties / op / description
      Previous value: -"between takes [low, high] and includes both ends; in/not_in take an array; contains/starts_with are case-insensitive text matches"New value: +"between takes [low, high] and includes both ends; in/not_in take an array; contains/starts_with are case-insensitive text matches; on date and timestamp columns a value can be relative to the time of the query: now, now-30d, now-12w, now-3m, now-1y"
    • changedInput schema / properties / where / items / properties / op / description
      Previous value: -"between takes [low, high] and includes both ends; in/not_in take an array; contains/starts_with are case-insensitive text matches"New value: +"between takes [low, high] and includes both ends; in/not_in take an array; contains/starts_with are case-insensitive text matches; on date and timestamp columns a value can be relative to the time of the query: now, now-30d, now-12w, now-3m, now-1y"
  2. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), so the bar is lower; the description nonetheless adds a genuinely non-obvious semantic rule — that sum/avg/count over a linked column count each linked row once per group, not once per source row. It also discloses stale-version behavior ('source_changed'), but says nothing about the cost or size of results.

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?

Roughly five dense sentences, front-loaded with the core operation, then the metric syntax, then the linked-column caveat, then the worked example. No filler, but the final sentence is long and carries two distinct ideas, which slightly hurts scannability.

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 analytical tool with no output schema, the description covers the hard parts: grouping with grain, metric definition syntax, link aliasing, version chaining, and the source_changed failure mode. What it omits — result shape, paging behavior, and row/group limits — is the remaining gap that keeps it from a 5.

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 only 33% across 9 parameters, so the description must compensate, and it does: it clarifies the accepted metric forms including '{ metric: name }' for approved definitions, that order_by may reference group columns or metric names, and that where/group_by/metrics accept alias.column for linked datasets. Gaps remain on limit/offset paging semantics, which are undocumented in both places.

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 opening sentence states a specific operation and resource: 'Totals, counts, averages, min and max, optionally grouped', and immediately enumerates the supported metric functions. It is clearly distinguishable from row-level retrieval siblings, though it never names an alternative for row-level needs, so it stops short of a 5.

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 through pointers rather than stated: 'describe_dataset lists them' for approved metric definitions and '(see describe_dataset links)' for linked columns, plus a concrete example ('revenue and target by country can come from one call'). The description does not say when to prefer this over row-level querying or when aggregation is impossible, so the agent must infer the selection rules.

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.