Skip to main content
Glama

apply_edits

Apply multiple Word edits in one validated, atomic batch. Anchors from a document view catch stale changes before mutation, saving as one undo step.

Instructions

Apply a batch of anchor-addressed edits in one call: one lock, backup, and validated save for the batch. Anchors come from get_document_view. Ops (each edit has "op"): replace {anchor, find, text, occurrence?} (omitted = every match); set_text {anchor, text} (whole paragraph); insert {location, markdown} (headings, plain paragraphs, lists, and pipe tables become real Word structures; location is the standard object); delete {anchor or anchors}; set_style {anchor, style}; format {anchor, formatting, find?, occurrence?}; 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 failed ops: re-view, resend). The changed map carries per-op results, with fresh anchors for inserted paragraphs, so follow-up batches chain without re-viewing. Ops run in order; keep deletes last. Auto-backup in file mode (backup=False skips rotation); atomic validated save. A document open in Word is edited live as ONE undo step: serialized, validated before any write, rolled back on mid-batch failure. Markdown lists/tables are file-mode only there; stale targets refuse: com_save_document (com-live pack) first, re-view, resend. Use this when a change needs two or more edits; for one, use the standalone tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
liveNoauto
editsYes
atomicNo
backupNo
file_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.0.0

TDQS

A5/5.0
Behavior5/5

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

The description is exceptionally transparent about behavior: batch validation before any mutation, batch-start text consistency, stale anchors refusing the entire batch, ordered execution, keep deletes last, auto-backup behavior, atomic save, live editing as one undo step, and rollback on mid-batch failure. These details go far beyond the single readOnlyHint=false annotation which merely signals mutability.

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?

Though long, the description is dense with necessary information and every sentence earns its place. It is front-loaded with the core batch behavior, then covers edit operations, validation semantics, execution order, live-document behavior, and concludes with a direct usage guideline.

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 tool's complexity, the description is remarkably complete. It covers all op types, anchor sources, validation semantics, failure handling, live/edit behavior, and the chaining workflow via fresh anchors. Since an output schema exists, the description correctly focuses on behavior and usage rather than return values.

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?

Schema description coverage is 0%, so the description must carry full parameter meaning, and it does. It thoroughly explains the edits array structure, each op type with its fields, anchor formats, occurrence semantics, and special cases like set_cell anchors. It also clarifies backup=False behavior and the atomic save behavior.

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'. It clearly distinguishes this batched tool from standalone single-edit tools by stating 'Use this when a change needs two or more edits; for one, use the standalone tool.'

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?

Explicitly states when to use this tool versus the standalone alternative: 'Use this when a change needs two or more edits; for one, use the standalone tool.' It also establishes the required workflow by specifying anchors come from get_document_view and instructs to re-view and resend on stale anchors.

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