Skip to main content
Glama

recalculate

Recalculate formulas in Excel files to fill cached values and detect errors. Ensures formulas return results instead of None, revealing formula issues before delivery.

Instructions

重算公式并扫描错误 —— 交付前必做的验证步骤(差异化能力,多数同类项目不支持)。

为什么需要它:openpyxl 写入的公式不带计算结果, 直接用 read_range 读会返回 None。重算能填上缓存值并暴露公式错误。

安全护栏(汲取官方 xlsx skill 的 recalc 思想):

  • 外链熔断:若工作簿引用了外部文件且缓存值已丢失, 重算会把它们变成 #NAME? 并永久删除外链(不可逆)。 此时本工具默认拒绝执行并列出风险项,确认接受损失才传 force=true。

  • 静默失败防护:比对文件指纹,若 LibreOffice 正常退出却没重写文件会明确报错。

参数:

  • timeout:超时秒数(默认 60,大工作簿请加大)

  • force:忽略外链风险强制执行(默认 False)

返回:total_errors、errors_by_type(含位置)、以及"重算通过≠结果正确"的提醒。 环境未装 LibreOffice 时会明确告知,不会静默假装成功。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNo
timeoutNo
file_pathYes

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 provided, the description fully discloses key behaviors: it mutates the workbook (recalculates), can permanently delete external links irreversibly, can fail silently if LibreOffice exits without writing, and requires LibreOffice to be installed. It also warns about the false positive of 'recalculation passed' not meaning 'result correct'. This is comprehensive behavioral disclosure that goes beyond what annotations would normally cover.

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 long but every sentence serves a purpose. It front-loads the core purpose and then logically groups safety, parameters, and returns. While concise would ideally be shorter, the density of critical information justifies the length. No fluff.

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?

Given the complexity of this tool (recalculation with external link risks, silent failures), the description is complete. It covers prerequisites (LibreOffice), side effects (permanent deletion), and error handling. With no output schema, it also describes return values in sufficient detail. An agent has everything needed to decide and invoke correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, so the description fully compensates by explaining every parameter: timeout for large workbooks, force for overriding external link risks, and file_path implied as the target. It also describes the return format (total_errors, errors_by_type) even though there is no output schema, which is extra value.

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 that the tool recalculates formulas and scans for errors, and it explicitly distinguishes itself from sibling tools by positioning it as a pre-delivery validation step. The phrase '重算公式并扫描错误' is a specific verb+resource, and the description differentiates it from tools like scan_formula_errors and read_range, which is genuinely useful.

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?

The description gives explicit context for when to use it: after writing formulas with openpyxl, because read_range would return None otherwise. It also explains when not to use it in risky situations (external links) and provides details about the force parameter as a conditional alternative. This is unusually thorough guidance.

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