Skip to main content
Glama
jgravelle
by jgravelle

aggregate

Read-only

Run server-side GROUP BY aggregations on tabular data, returning summaries instead of raw rows to reduce token usage. Includes count, sum, avg, min, max, count_distinct, median.

Instructions

Server-side aggregations (GROUP BY). Saves orders of magnitude in tokens vs returning rows for the LLM to aggregate. Functions: count, sum, avg, min, max, count_distinct, median. limit capped at 1000.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax groups returned (default 50)
havingNoPost-aggregation filter on aggregation aliases (B11). Each item: {"column": <alias>, "op": eq|neq|gt|gte|lt|lte|in|between|is_null, "value": ...}
redactNoScrub PII / credentials from group-by column values (default true). Aggregate values (counts, sums, etc.) are never altered.
datasetYesDataset identifier
filtersNoPre-filter rows before aggregating (same syntax as get_rows)
group_byNoGroup-by columns. Empty = whole-dataset aggregate.
order_byNoColumn or alias to sort by
order_dirNodesc
approximateNoApproximate-mode aggregation (C1). Routes count_distinct → HyperLogLog (~2% error), median → t-digest (~1% error), sum/avg → sampled estimator with 95% confidence interval. Whole-dataset only.
aggregationsYesAggregation specs. Use column='*' for COUNT(*).
redact_patternsNoAdditional Python regex patterns to layer on top of the built-in set.
redact_skip_columnsNoGroup-by column names to exempt from redaction.
Behavior4/5

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

The annotation readOnlyHint: true covers the safety profile, and the description adds useful behavioral context: it is server-side, performs GROUP BY aggregations, and caps results at 1000. It also mentions a performance benefit (token savings). No contradictions with annotations.

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?

The description is extremely concise—four short sentences, each earning its place: what it does, why it's beneficial, supported functions, and a key limit. There is zero fluff or repetition.

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?

Given the high schema coverage and read-only annotation, the description covers the essential context: purpose, token efficiency, functions, and limit. It does not describe return format, but that is not critical here. It omits some advanced behaviors (e.g., approximate mode) that are well documented in the schema, so it remains complete enough.

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 description coverage is 92%, so the schema carries most parameter meaning. The description adds minimal extra insight, such as the 'limit capped at 1000' (not in schema) and enumerates the functions, but otherwise does not explain parameter semantics beyond what schema already provides. Baseline 3 is appropriate.

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 identifies the tool as 'Server-side aggregations (GROUP BY)', which is a specific verb-resource combination. It distinguishes itself from sibling tools like get_rows and sample_rows by explicitly noting that it saves tokens versus returning rows for the LLM to aggregate, and lists the supported functions.

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 provides clear context on when to use it: when the LLM needs aggregated data rather than raw rows. It does not explicitly name alternatives like run_sql, but the token-saving statement implies a preference over row-returning tools. The 'limit capped at 1000' also sets expectations for scale.

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/jgravelle/jdatamunch-mcp'

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