Skip to main content
Glama

Add a pivot table

add_pivot_table

Summarize a Google Sheets table with a pivot table: group rows or columns, total, count, or average values, and output to a new tab or chosen anchor cell.

Instructions

Summarize a table with a pivot table: group by one or more columns, and total, count or average others. It goes on a new tab unless anchor_cell is given. The source range needs a header row; refer to columns by header name or letter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsNoColumns to group by down the side, e.g. ["Region"]
valuesYes
accountNoGoogle account to use: an email or unique part of one (e.g. "acme.com"). Default: the account that can open the spreadsheet, else the default account.
columnsNoColumns to group by across the top
anchor_cellNoTop-left cell for the pivot table, e.g. "Summary!A1". The area below and right of it must be empty. Default: a new tab
show_totalsNo
spreadsheetYesGoogle Sheets link or spreadsheet ID. The name of a spreadsheet used with Sheets MCP before also works
new_tab_nameNoName for the new tab when anchor_cell isn't givenPivot
source_rangeYesThe table to summarize, header row included, e.g. "Orders!A1:F500" or a tab name

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.1

TDQS

A4.4/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false, destructiveHint=false, openWorldHint=true; the description adds the key side-effect disclosure that a new tab is created unless anchor_cell is given, and warns of the anchor-cell area constraints implied by the schema. Adds write-location context beyond the security profile.

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?

Three tight sentences, front-loaded with purpose, then placement behavior, then the prerequisite. No repetition of schema fields; every clause earns its place.

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 9-parameter mutation tool with no output schema, the description covers purpose, side effects, and prerequisites adequately. Minor gap: it doesn't clarify that show_totals/new_tab_name interact with the default placement, though the schema implies this.

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 coverage is 78%, so the schema carries most parameter detail, but the description adds genuine semantics: that columns may be referenced by header name or letter and that a header row is required — neither stated in the schema itself. This meaningfully reduces invocation error.

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?

Specific verb+resource: "Summarize a table with a pivot table." No sibling tool creates pivot tables, so the purpose is immediately unambiguous and distinguishable from add_chart, set_filter, and sort_range.

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?

Description gives concrete prerequisites (source range needs a header row, columns referenced by header name or letter) and states the default placement (new tab vs anchor_cell). It lacks explicit when-not-to-use guidance, but no sibling competes for this task.

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