Skip to main content
Glama

aggregate

Compute counts, sums, averages, min/max, and grouped totals across records on the server, replacing manual paging and addition. Supports filters, linked records, and date bucketing.

Instructions

Count and total active records on the server instead of paging and adding by hand. Filters are the same as search_records (collection_id, where, filters, text, linked_to). metrics = [{op: count}] or [{op: sum|avg|min|max, field: [keys], type?}]; min/max accept type "string" for ISO dates. group_by = {field: [keys], bucket?: "month"|"year"} or {collection: true} or {linked: {relationship_types?, direction?}} (e.g. spend per vendor). ALWAYS read used, skipped_missing and skipped_non_numeric on each metric before quoting a total: a value stored as "95 LPA" or left blank is skipped, not counted as zero, so say how many records the figure leaves out. With linked grouping a record linked to several records counts in each group, so groups can sum to more than matched. Up to 100 groups, largest first; groups_truncated reports more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNo
limitNo
whereNo
filtersNo
metricsNo
group_byNo
linked_toNo
collection_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so thoroughly. It warns that missing and non-numeric values are skipped rather than zeroed, explains double-counting in linked grouping, states group ordering, and points to groups_truncated for overflow. These are exactly the caveats an agent needs before quoting results.

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 dense but every sentence adds operational value. Compact notation for metrics and group_by, a concrete example, and a highlighted ALWAYS warning make the complexity manageable without wasted words.

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 8 parameters, no annotations, and an output schema that can define return fields, the description covers the main call patterns, edge cases, and result caveats. Minor gaps such as the role of limit and full self-contained filter semantics keep it from being fully complete, but it is strong overall.

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 0%, so the description compensates by precisely specifying metrics and group_by syntax and referencing search_records for filter parameters. It leaves limit and the full details of where/filters/text/linked_to implicit, but the core aggregation parameters are documented well enough for correct invocation.

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 opens with a specific verb and resource ('Count and total active records on the server') and immediately contrasts with manual paging, making it clear this is the aggregation counterpart to search_records. It is not a tautology and clearly differentiates the tool from sibling read/fetch tools.

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 phrase 'instead of paging and adding by hand' gives a strong when-to-use signal, and 'Filters are the same as search_records' routes the agent to a familiar sibling. However, it does not explicitly state when not to use aggregate or how to choose among all read-focused siblings.

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