Skip to main content
Glama

Apply Edits

apply_edits
Destructive

Apply a batch of anchor-addressed edits to a Word document in one validated call: replace, insert, delete, move, or format with automatic backup and rollback on failure.

Instructions

Apply a batch of anchor-addressed edits in one call: one lock, backup, and validated save. Anchors come from get_document_view. Ops (each edit has "op"): replace {anchor, find, text, occurrence?} (omitted = every match); set_text {anchor, text}; insert {location, markdown} (headings, paragraphs, lists and pipe tables become real structures); delete {anchor or anchors}; move {anchor or anchors, location, allow_cross_section?} (verbatim relocation, file mode only; refuses a paragraph holding a section break, and a landing in another section unless allowed); set_style {anchor, style}; format {anchor, formatting, find?, occurrence?} (no find = whole paragraph, mark included); set_paragraph_format {anchor, format}; set_cell {anchor: "t:hex:rNcN", text}. The whole batch validates BEFORE anything mutates, against BATCH-START text (never reference text an earlier op creates); one stale anchor refuses it all (STALE_ANCHOR lists the failed ops). changed carries per-op results plus fresh anchors for inserted paragraphs, so batches chain without re-viewing. Ops run in order; keep deletes last. Edits are applied directly, so under track changes they warn rather than record a revision. Auto-backup in file mode; atomic validated save. A document open in Word is edited live as ONE undo step, rolled back on mid-batch failure; markdown lists/tables and move are file-mode only there.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
liveNoauto: file or live; force: live; off: refuseauto
editsYes
atomicNo
backupNo
file_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.2.1
    • addedInput schema / properties / live / description
      Added value: +"auto: file or live; force: live; off: refuse"
    • addedInput schema / properties / live / enum
      Added value: +[
      +  "auto",
      +  "force",
      +  "off"
      +]
  2. Addedv2.0.0

TDQS

A4.7/5.0
Behavior5/5

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

The description goes well beyond the annotations by disclosing validation-before-mutation, stale-anchor refusal, per-op results with fresh anchors, direct application under track changes, auto-backup, atomic save, and live-edit behavior with rollback on mid-batch failure. It also notes file-mode restrictions for markdown lists/tables and move. This is rich behavioral context.

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 dense and front-loaded with the primary purpose before diving into operation definitions. There is slight redundancy (e.g., mentioning 'validated save' and later 'atomic validated save', and repeating backup/lock concepts), but given the tool's complexity, each section earns its place.

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 tool with this many operation variants and behavioral caveats, the description is highly complete. It covers validation semantics, error behavior, ordering, live vs file modes, backup, and what 'changed' contains. Since an output schema exists, the description correctly focuses on behavior and constraints rather than return-value details.

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?

With only 20% schema description coverage, the description carries nearly the entire parameter burden. It fully specifies each operation object accepted in 'edits', including optional fields such as occurrence, location, allow_cross_section, and the 't:hex:rNcN' anchor format for set_cell. This thoroughly compensates for the sparse 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 opens with a specific verb and resource: 'Apply a batch of anchor-addressed edits in one call', and then enumerates the full set of operations (replace, set_text, insert, delete, move, set_style, format, set_paragraph_format, set_cell). This clearly distinguishes it from single-purpose sibling edit tools by emphasizing batch, anchor-addressed, and atomic behavior.

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 gives clear usage context: anchors come from get_document_view, edits are batched into one call, and ordering guidance is provided ('Ops run in order; keep deletes last'). It does not explicitly name alternatives or say when not to use this tool, but the context is strong enough for an agent to infer the right scenario.

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