Skip to main content
Glama

apply_edits

Apply a batch of anchor-addressed edits to a Word document in one validated save, with atomic locking, backup, and rollback. Use for multi-edit changes that must succeed or fail together.

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. Dates show when Glama detected each change.

  1. Addedv2.0.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden, and it does so well. It discloses validation-before-mutation, all-or-nothing stale-anchor behavior, changed-map results, operation ordering, backup behavior, atomic save, live Word undo-step semantics, rollback, and file-mode limitations.

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?

The description is dense but appropriately so for a complex batch API with no schema-level documentation. The core behavior and when-to-use guidance are front-loaded, followed by op details and failure-recovery guidance. Every clause adds operational value.

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?

The description covers anchor sourcing, per-op semantics, validation order, stale-anchor failure handling, chaining via fresh anchors, operation ordering, backup, atomicity, live Word behavior, markdown limitations, and recovery steps. Combined with the output schema, an agent has sufficient context to invoke the tool 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?

Schema description coverage is 0%, but the description compensates by thoroughly documenting the edit op shapes and fields: replace, set_text, insert, delete, set_style, format, set_paragraph_format, and set_cell. It even gives the anchor format for set_cell and clarifies backup=False 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 clearly states that this tool applies a batch of anchor-addressed edits in one call, and specifies that anchors come from get_document_view. It also distinguishes itself from single-edit standalone tools by noting it is for changes needing two or more edits.

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?

It explicitly says to use this when a change needs two or more edits and to use the standalone tool for one edit. It also gives a recovery workflow: re-view, resend, and if stale targets refuse, use com_save_document first.

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

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/nometalalchemist/KitchenSink4Word'

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