Skip to main content
Glama

search_and_replace

Batch find and replace in Word documents across body, footnotes, headers, or all, with preview dry-runs, formatting-restricted replacements, tracked changes, and safety limits.

Instructions

Batch find/replace, safe across Word's fragmented runs. Each item: {find, replace, regex?}; scope: body | footnotes | headers | all. preview=true dry-runs the same engine without touching the file: per-item counts, each match with paragraph index and before/after context, the grand total, and the refusals a real run would hit; review, then rerun with max_replacements set to the previewed total so drift aborts instead of over-replacing. find_formatting={bold, italic, font, size_pt, color, highlight, style, ...} restricts replacement to text carrying that effective formatting (file mode only, no regex; an item without find replaces each entire matching stretch, and the replacement keeps the matched formatting). max_replacements aborts, changing nothing, when total matches would exceed it. track records each replacement as a tracked change by author. Sibling: set_paragraph_text rewrites one whole paragraph when a find string would be unwieldy. Live edits appear immediately as one Ctrl+Z step, unsaved until the user saves; the live result adds live:true and skip counters, and literal finds beyond Word's ~255-char limit are handled automatically. Auto-backup in file mode (backup=False skips rotation); atomic validated save. Documents open in Word edit live, serialized; tracked replaces never re-match their own markup. For anchor-scoped edits, use apply_edits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
liveNoauto
scopeNobody
trackNo
authorNoClaude
backupNo
previewNo
file_pathYes
replacementsYes
find_formattingNo
max_replacementsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.0.0
    • addedInput schema / properties / find_formatting
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedInput schema / properties / preview
      Added value: +{
      +  "default": false,
      +  "type": "boolean"
      +}
  2. Changed1 schema field changedv1.6.1
    • addedInput schema / properties / live
      Added value: +{
      +  "default": "auto",
      +  "type": "string"
      +}
  3. First observedv1.2.1

TDQS

A4.8/5.0
Behavior5/5

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

This is exceptionally transparent about side effects: preview dry-runs without touching the file, max_replacements aborts with no changes, live edits appear as one Ctrl+Z step and remain unsaved, file mode creates auto-backups and does an atomic validated save, and tracked replaces never re-match their own markup. These disclosures go far beyond the minimal readOnlyHint=false annotation and accurately describe mutation behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is information-dense but poorly structured: multiple distinct concerns (safety, preview, formatting, live editing, backup, siblings) are packed into one run-on wall of text with semicolons. It is front-loaded with purpose, and every sentence carries useful content, but the lack of grouping or paragraph breaks makes it harder for an agent to parse and retain, so it is not a model of conciseness.

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 complex mutation tool with 10 parameters, the description covers the core operation, scope, preview output fields, formatting restrictions, safety limits, tracking behavior, live-edit semantics, backup handling, and sibling routing. The output schema exists, and the description still adds useful detail about result fields like live:true and skip counters, so nothing critical appears missing.

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 carries the full burden, and it delivers. It explains the replacements item shape {find, replace, regex?}, enumerates scope values, defines preview=true, max_replacements, track, author, backup, live, and find_formatting semantics. No parameter is left to pure guessing.

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 opening line, 'Batch find/replace, safe across Word's fragmented runs,' names a specific verb and resource while immediately flagging the tool's distinguishing value. It also differentiates from siblings by explicitly pointing to set_paragraph_text and apply_edits for cases where this tool is not the right fit.

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 concrete when-to-use guidance: use set_paragraph_text when a find string would be unwieldy, and use apply_edits for anchor-scoped edits. It also prescribes a full preview-then-rerun workflow with max_replacements, making the correct invocation sequence explicit.

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