Skip to main content
Glama

aggregate

Read-onlyIdempotent

Aggregate a dataset: sum/avg/count/min/max of a field, optionally grouped by one or more fields, with an optional RSQL filter. Use this for cross-cutting questions like highest-value customers (aggregate order, sum, localPrice, groupBy=[customerOrganisationName], filter="state==ORDER") or revenue by process. Datasets that carry a voided/deleted flag exclude those rows by default (see the Scope line from describeQueryableFields); line-item datasets like requisition are NOT scoped by their parent order's status, so filter explicitly for placed-orders-only revenue. Datasets: order, partRevision, partSpecification, productionStep, customerOrganisation, cart, requisition, workOrder, processPrices, materialPrices, postProcessing, typescriptEquation, operation, batchMovement, scrap, material, color, jurisdiction, leadTime, precisionPrices, infill, taxJurisdiction, taxComponent, paymentTerm, discount, shippingBox, shippingMethod, routingTemplate, kanbanColumn, documentTemplate. Call describeQueryableFields(entity) for valid field names.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sortNo'asc' or 'desc' by the metric value (default desc).
fieldNoNumeric field to aggregate (required for all metrics except count). Use describeQueryableFields(entity) for valid names.
limitNoMax groups to return (1-50, default 20).
entityYesDataset to aggregate. One of: order, partRevision, partSpecification, productionStep, customerOrganisation, cart, requisition, workOrder, processPrices, materialPrices, postProcessing, typescriptEquation, operation, batchMovement, scrap, material, color, jurisdiction, leadTime, precisionPrices, infill, taxJurisdiction, taxComponent, paymentTerm, discount, shippingBox, shippingMethod, routingTemplate, kanbanColumn, documentTemplate.
filterNoOptional RSQL filter applied before aggregating (same syntax as query).
metricYessum, avg, count, min or max.
groupByNoOptional fields to group by (e.g. customerOrganisationName, technology). Omit for a single total.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds valuable behavioral context beyond that: default exclusion of voided/deleted rows, the line-item scoping caveat, and the default sort/limit behavior (desc, 20). It does not describe the exact return shape, but with no output schema and a read-only aggregation tool, the added context is strong.

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 dense but well-organized: the core operation and examples come first, followed by the scoping caveat and dataset list. The dataset list is long but necessary since the schema repeats it and the tool needs valid entity names. Every sentence earns its place, though the list could arguably be trimmed by pointing to describeQueryableFields.

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 read-only aggregation tool with 7 parameters and no output schema, the description covers the key decision points: which metric needs which field, how grouping works, how filtering works, and the voided/deleted scoping caveat. It does not describe the response format, but for an aggregation tool the return shape is fairly predictable and the description already points to describeQueryableFields for field discovery.

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 100%, so the schema already documents every parameter. The description adds meaning by explaining the metric-field relationship ('field required for all metrics except count'), giving a concrete groupBy/filter example, and clarifying that omitting groupBy yields a single total. It also points to describeQueryableFields for valid field names, which is useful cross-tool guidance.

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 ('Aggregate a dataset') and immediately enumerates the supported operations (sum/avg/count/min/max), optional grouping, and optional filtering. It also names concrete use cases (highest-value customers, revenue by process) and lists the valid datasets, which distinguishes it from sibling tools like query and explainPrice.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says when to use this tool ('Use this for cross-cutting questions like...') and gives a concrete example with parameters. It also warns about a subtle scoping issue: datasets with a voided/deleted flag exclude those rows by default, and line-item datasets like requisition are NOT scoped by parent order status, so the agent must filter explicitly. This is exactly the kind of when/why guidance an agent needs.

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.

Resources