Skip to main content
Glama

Aggregate Sheet Data

sheet.aggregate
Read-onlyIdempotent

Compute one or more aggregations (COUNT, DISTINCT_COUNT, SUM, AVG, MIN, MAX, FIRST, LAST) over a sheet's rows, with optional filter and groupBy. Use for analytical questions like 'total revenue by stage', 'count of leads created this month', 'average response time per assignee'. Multiple functions in one call share the same column/filter/groupBy — pass ["SUM", "AVG"] together to get both for free. For date columns, group with timeBucket: 'month' (or 'quarter', etc.). Filter operators include the usual comparison ops plus date shortcuts (THIS_MONTH, BEFORE_TODAY, etc.) — see the schema. Filter values on Status, Select, Multi-Select, Pipeline, person, team, job and relation columns may be the names you see in sheet.read (e.g. 'Done'); grouped rows carry label = the name and labelId = the raw id. Read sheet.read once first to discover attribute codes; aggregate is the right tool when raw rows would exceed your context.

Input Schema

NameRequiredDescriptionDefault
columnNo
filterNo
groupByNo
sheetIdYes
functionsYes

Output Schema

NameRequiredDescriptionDefault
rowsYesAggregation rows as the worksheet service returns them, one per group
summaryYesEcho of the request that ran

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / filter / properties / conditions / items / properties / value / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "items": {
      -      "anyOf": [
      -        {
      -          "type": "string"
      -        },
      -        {
      -          "type": "number"
      -        }
      -      ]
      -    },
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "items": {
      +      "type": [
      +        "string",
      +        "number"
      +      ]
      +    },
      +    "type": "array"
      +  }
      +]
  2. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, so safety is covered. The description adds genuinely new behavior: multiple functions in one call share the same column/filter/groupBy, filter values may be human-readable names rather than ids, and grouped rows return both `label` and `labelId`. It does not mention result-size limits or cost of large group-bys, which is the remaining gap for an aggregation endpoint.

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?

Front-loaded with the verb and resource, then layered with usage examples, the multi-function optimization, and schema pointers. Every sentence carries information, though the parenthetical operator list and the two domain-specific notes about Status/Pipeline columns could be tightened without losing meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only tool with a nested filter object, five parameters, and an output schema that covers return shape, the description supplies the missing operational context: attribute-code discovery, name-based filtering, grouping labels, and time bucketing. Nothing an agent needs in order to call this correctly is absent.

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 carries the burden and largely succeeds: it explains the shared-scope semantics of `functions`, when to use `timeBucket` on date columns, and that filter operators include comparison ops plus date shortcuts. It does not clarify when `column` is required versus optional (SUM/AVG need it, COUNT does not), which is the main semantic hole left for a 5-parameter nested schema.

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?

Names the exact operation (compute aggregations over a sheet's rows), enumerates the supported functions, and explicitly positions itself against the sibling sheet.read ('aggregate is the right tool when raw rows would exceed your context'). An agent can distinguish it from sheet.read, sheet.schema, and view.* tools without opening any schema.

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?

Gives concrete when-to-use examples ('total revenue by stage', 'count of leads created this month'), states the prerequisite workflow ('Read sheet.read once first to discover attribute codes'), and names the alternative (raw rows via sheet.read). Both the positive case and the routing decision are spelled out.

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