Skip to main content
Glama

create_pivot

Generate a static pivot summary table from Excel data and write it to a new worksheet. Group rows and aggregate values using sum, mean, count, min, or max.

Instructions

生成透视汇总表(写入新工作表)。

⚠️ 诚实说明:openpyxl 无法创建真正可交互的 PivotTable 对象, 本工具生成的是静态汇总表(分组聚合后写回),数值等价但不可交互。 需要可交互透视表时,请在 Excel 中基于结果表插入。

参数:

  • rows:行分组字段(可多列),如 ["部门"]

  • values:要聚合的数值列,如 ["销售额"]

  • agg_func:sum/mean/count/min/max(默认 sum)

  • columns:列分组字段(可选,做交叉表)

  • filters:过滤条件(格式同 filter_count)

  • target_sheet:结果表名(默认"透视表")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsYes
valuesYes
columnsNo
filtersNo
agg_funcNosum
file_pathYes
source_sheetNo
target_sheetNo透视表

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden. It honestly discloses the key limitation: openpyxl cannot create interactive pivots, so the result is a static summary. It also notes that it writes to a new worksheet, implying non-destructive behavior. This is transparent and useful.

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 moderately long but every sentence adds value. The warning about interactivity is essential, and the parameter list is structured and readable. It is front-loaded with the main purpose and then provides details, making it easy to scan.

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 the tool's complexity and lack of output schema, the description covers the necessary operational details: it mentions writing to a new sheet, filter format (referencing filter_count), and the limitation of static output. It doesn't explicitly state return values, but since the tool's effect is writing a sheet, that is implicit. It is sufficiently complete for an agent to call correctly.

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 must explain parameters. It does so for rows, values, agg_func, columns, filters, and target_sheet, including examples and defaults. file_path and source_sheet are not explicitly explained, but they are self-explanatory from the tool's context. The description adds significant meaning beyond the bare 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?

The description clearly states the tool generates a pivot summary table written to a new worksheet. It distinguishes itself from interactive pivots by explicitly noting it creates a static summary, which differentiates it from the sibling create_interactive_pivot.

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 description provides clear guidance on when not to use it (when an interactive pivot is needed) and directs the user to Excel for that case. It doesn't mention other alternatives like aggregate, but the primary differentiator is covered. The context of writing to a new sheet is also clear.

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