Skip to main content
Glama

write_cells

Write multiple Excel cells in one batch call to avoid slow per-cell loops and repeated backups. Supports formulas and automatic .bak rollback for safe updates.

Instructions

批量写入多个单元格 —— 一次调用完成,不要用单格写入循环调用。

这是批量接口:请在一次调用里传入所有要写的单元格, 服务只做一次文件读写周期。逐格循环调用会慢很多且反复触发备份。

参数:

  • cells:列表,每项 {"cell": "B2", "value": "内容"}; value 以 "=" 开头会被当作公式写入(如 "=SUM(B3:B9)")

  • sheet:工作表名,省略则写活动表

  • create_sheet_if_missing:工作表不存在时是否新建(默认 False,避免误建表)

安全:写入前自动生成 .bak 备份 + 原子保存,可用 revert_last_write 回滚。 限制:单次最多 10 万个单元格。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cellsYes
sheetNo
file_pathYes
create_sheet_if_missingNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations present, the description carries the full burden and delivers: writes are atomic, a .bak backup is created, revert_last_write can roll back, formulas are recognized by '=' prefix, and there is a 100k-cell limit. This goes well beyond the bare schema.

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?

The description is front-loaded with the batch mandate, then uses compact labeled sections for parameters, safety, and limits. Every sentence adds operational value; no filler.

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 4-parameter mutation tool with no annotations and no output schema, the description covers purpose, all non-obvious parameters, safety/rollback behavior, and hard limits. Nothing required to call it correctly is missing; return-value detail is not essential for a write operation.

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 0%, so the description must add meaning. It thoroughly explains cells (list of {cell, value} objects and formula behavior), sheet (defaults to active sheet), and create_sheet_if_missing (default False). Only file_path is not discussed, though its name/title makes it self-explanatory.

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 ('批量写入多个单元格') and immediately frames it as a batch interface. It distinguishes itself from a single-cell write loop, so an agent knows exactly what the tool does and how it differs from the naive alternative.

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?

It explicitly instructs '请在一次调用里传入所有要写的单元格' and warns '不要用单格写入循环调用', giving a clear when-to-use and when-not-to-use. It also explains the rationale (single file read/write cycle vs slow repeated backups) and notes create_sheet_if_missing defaults to False to avoid accidental sheet creation.

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