Skip to main content
Glama

replace_text

Replace specific text in a Word paragraph with optional tracked changes (red strikethrough + underlined insertion) or immediate replacement. Uses context anchoring for precision.

Instructions

Replace text in a paragraph.

With tracked=True (default) the old text is shown as red strikethrough and the new text as an underlined insertion — the human reviewer accepts/rejects in Word. Only the actually-changed portion is marked; common leading/trailing text is left as plain runs. With tracked=False the replacement is applied immediately without any visible markup.

Args: para_id: paraId of the target paragraph. find: Text to find and replace (may span run boundaries). replace: Replacement text. author: Author name shown in Word's review pane (tracked=True only). context_before: Text immediately before the target (for precise anchoring). context_after: Text immediately after the target (for precise anchoring). tracked: True (default) = strikethrough + underline the human accepts/rejects. False = replaced immediately, no markup. document_handle: Optional handle for concurrent session isolation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
para_idYes
findYes
replaceYes
authorNoClaude
context_beforeNo
context_afterNo
ignore_caseNo
trackedNo
document_handleNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

No annotations, so description carries full burden. It details tracked change behavior (strikethrough/underline markup, only changed portion marked, author attribution) and immediate mode. Missing mention of destructive nature or reversal potential, but covers key behavioral traits.

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?

Front-loaded with a one-sentence summary, followed by a clear bullet-style ARG list. Every sentence adds value—no filler or redundancy. Concise yet comprehensive.

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?

Given 9 parameters and no annotations, the description covers most behavioral and operational aspects (tracked mode, anchoring, author, session isolation). Missing only the 'ignore_case' parameter, and output is handled by existing output schema.

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?

Adds significant meaning to 8 of 9 parameters (para_id, find, replace, author, context_before, context_after, tracked, document_handle). However, 'ignore_case' is documented in the schema but not in the description, which is a gap despite high schema coverage responsibility.

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?

Clear verb 'replace', specific resource 'text in a paragraph', and distinguishes from siblings like 'delete_text' and 'insert_text' by detailing tracked vs immediate mode. The description makes its purpose unmistakable.

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?

Explains when to use tracked=True vs False, and how context_before/context_after anchor replacements. However, lacks explicit guidance on when not to use this tool versus alternatives like 'find_replace_formatted' or 'redact_text'.

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

Install Server

Other Tools

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/SecurityRonin/docx-mcp'

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