Skip to main content
Glama

写入公式

set_formula

Set an Excel formula in a specified cell; the result computes when the file opens, so reading the cell immediately returns null.

Instructions

在指定单元格写入 Excel 公式,如 SUM(A1:A10),可带或不带开头的 =。注意:公式要等用户在 Excel/WPS 里打开文件后才会计算出结果,本工具读该格会得到 null。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cellYes单元格地址,如 `B5`
formulaYes公式文本,如 `SUM(A1:A10)` 或 `=AVERAGE(B2:B30)`
filePathYesExcel 文件的绝对路径,例如 `C:\Users\xx\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv
sheetNameYes
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the key behavioral trait: formulas aren't evaluated until opened in Excel/WPS, so reading the cell returns null. This is genuinely useful. However, it doesn't mention whether existing values in the cell are overwritten, required file-open state, or permission needs — moderate gaps for a mutation tool with zero annotation support.

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, front-loaded with the core purpose and example, followed by one critical behavioral note. Zero wasted words and every sentence 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 4-param mutation tool with no output schema, this is fairly complete. The critical behavioral caveat (formula not evaluated until opened, returns null on read) is disclosed, which is the main thing an agent needs to know. The main gap is that sheetName receives no description in either schema or description, and there's no mention of what happens on write or error conditions, but the core semantics are well covered.

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 75%, so most parameters (filePath, cell, formula) are already described in the schema. The description adds meaningful value by explaining the optional leading '=' for the formula and the null-read behavior, which the schema's formula description doesn't capture. The sheetName has minimal schema description, and the description doesn't compensate for it, but overall the value-add over schema is notable.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool writes an Excel formula into a specified cell, with a concrete example (SUM(A1:A10)). It's specific about the verb (write) and resource (Excel formula in a cell). However, it doesn't explicitly contrast with siblings like write_range or format_cells, though 'formula' is reasonably distinctive given write_range is a sibling — the distinction is somewhat implicit rather than explicit.

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 a critical usage context: the formula won't be calculated until opened in Excel/WPS, and reading the cell returns null. This gives strong guidance on when to use this tool (vs. expecting immediate values) and warns about expected behavior. It doesn't name explicit alternatives but the context signal about formula evaluation is valuable and informative.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mutoukenji/mcp-excel'

If you have feedback or need assistance with the MCP directory API, please join our Discord server