Skip to main content
Glama

edit_document

Apply validated operations to a named Word document in one call, resolving text or paragraph targets and saving only after every edit passes.

Instructions

Edit a document the user named by source, in one call: registers it, resolves targets, and applies the operations - use this instead of register_document + find_in_document + apply_plan. planJson is an operations array [ … ] or { "operations": [ … ] }, the same operations preview_plan documents. Targets may name text directly instead of a paragraph id, so no lookup call is needed first: { "op": "changeText", "target": { "find": "Acme Corp" }, "with": "Globex Inc." } If that text matches more than once the call fails with 'ambiguous-anchor' and lists each candidate with its context; re-issue with { "find": "Acme Corp", "match": 2 } (zero-based) or use more surrounding text. Text that matches nothing fails with 'anchor-not-found'. Anchors resolved from inspect_document/find_in_document ({ "paraId": …, "expect": … }) work here too, and can be mixed in the same plan. saveMode and newName behave as in apply_plan. Nothing is written unless every operation validates. Returns the apply_plan shape plus sourceDocumentId - the id of the document that was opened, usable for follow-up calls even when the edit failed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes
newNameYes
planJsonYes
saveModeYesReplace
connectionIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.7.0

TDQS

A4.7/5.0
Behavior5/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 and largely meets it: it discloses atomicity ('Nothing is written unless every operation validates'), named error conditions ('ambiguous-anchor', 'anchor-not-found'), the zero-based match-index retry mechanism, and the return shape including sourceDocumentId being usable 'even when the edit failed'. Permissions/rate limits are unaddressed but are not central to correct invocation here.

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 critical routing statement and the one-call summary are front-loaded, and the inline JSON examples earn their space by making the target syntax actionable. It is dense and somewhat long with several nested inline structures, but virtually no sentence is padding.

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?

No output schema, but the description compensates by describing the return ('apply_plan shape plus sourceDocumentId'). Atomicity, error codes and retry semantics are all present. The remaining gap is two under-specified required inputs (connectionId, and the exact nature of source), which an agent must guess at.

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 compensate. It does so thoroughly for planJson (accepted shapes, operation list contents, target object form, mixing paraId/expect anchors) and points to apply_plan for saveMode/newName. However, source is left vague ('a document the user named by source' — name? path? id?) and connectionId is never explained at all.

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?

States a concrete verb and resource (edit a document the user named by source) and explicitly enumerates what it does in one call: registers, resolves targets, applies operations. It also names the exact siblings it supersedes (register_document + find_in_document + apply_plan), so an agent can discriminate it from them without opening any schema.

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?

Explicit routing guidance: 'use this instead of register_document + find_in_document + apply_plan', plus a stated precondition-free path (targets may name text directly 'so no lookup call is needed first'). It also covers what to do on the two failure modes, i.e. when to re-issue with a match index or longer text.

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