Skip to main content
Glama

Aggregate sheet

aggregate_sheet
Read-only

Groups spreadsheet rows by chosen columns and calculates sums, means, counts, or other metrics per group, returning one summary record per group.

Instructions

Group rows and compute totals per group (e.g. sum of Amount by Region). Returns one record per group.

Use for summaries of a table; to list individual matching rows use query_sheet.

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": {
      "sheet": "<sheet>",
      "group_by": "<group_by>",
      "agg": "<agg>"
    },
    "name": "aggregate_sheet"
  }
}

Input Schema

NameRequiredDescriptionDefault
aggYesHeader name -> function: sum, mean, min, max, count, median, nunique, first or last. E.g. {"Amount": "sum"}.
pathNoFile path or preloaded name (list_configured_files). Omit if only one file is preloaded.
sheetYesSheet name (case-sensitive).
group_byYesHeader names to group by, e.g. ["Region"].
cell_rangeNoRange to read, e.g. "A1:F500". Omit for the whole sheet.
has_headerNoFirst row holds column names. When false, columns are named col_0, col_1, ...

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.4.0
    • addedInput schema / properties / agg / description
      Added value: +"Header name -> function: sum, mean, min, max, count, median, nunique, first or last. E.g. {\"Amount\": \"sum\"}."
    • addedInput schema / properties / cell_range / description
      Added value: +"Range to read, e.g. \"A1:F500\". Omit for the whole sheet."
    • addedInput schema / properties / group_by / description
      Added value: +"Header names to group by, e.g. [\"Region\"]."
    • addedInput schema / properties / has_header / description
      Added value: +"First row holds column names. When false, columns are named col_0, col_1, ..."
    • addedInput schema / properties / path / description
      Added value: +"File path or preloaded name (list_configured_files). Omit if only one file is preloaded."
    • addedInput schema / properties / sheet / description
      Added value: +"Sheet name (case-sensitive)."
  2. First observedv0.1.0

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 and openWorldHint=false, so the safety profile is covered. The description adds useful behavioral context beyond that: it discloses the result shape ('one record per group'), which tells the agent the output is aggregated rather than row-level. It does not discuss edge cases such as non-numeric columns or empty groups, but with an output schema present that is a minor gap.

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?

Two sentences, zero filler, with the core behavior and the result shape front-loaded before the alternative-tool routing. Every clause carries information.

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 aggregation tool with full schema coverage, complete annotations, and an output schema, the description covers purpose, output shape, and sibling routing. Nothing an agent needs to select or invoke it correctly is missing.

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 100%, so the schema already documents every parameter including the agg function list and the group_by header names. The description's example ('sum of Amount by Region') restates the same semantics rather than adding new meaning, so the baseline 3 applies.

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?

States a specific verb and resource ('Group rows and compute totals per group') with a concrete example ('sum of Amount by Region') and the output cardinality ('one record per group'). It also names the sibling it is not, so an agent can distinguish it from query_sheet without opening either 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?

Explicitly gives the when-to-use condition ('summaries of a table') and the when-not with the named alternative ('to list individual matching rows use query_sheet'). The routing decision is fully determined by the description.

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