Skip to main content
Glama

word_replace

Replace text in Word documents while preserving formatting. Provide source and output paths plus a JSON replacement map to update .docx files.

Instructions

Replace text in a Word document, preserving all formatting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYessource .docx path
fmt_hintsNooptional JSON string with run-format hints, e.g.: {"_fmt:p:1": {"runs": [{"text": "中一", "underline": true}]}}
output_pathYeswhere to save the new .docx
replacementsYesJSON string with replacement map, e.g.: {"p:0": "new title", "c:0:3:0": "line1\nline2", "c:0:2:1:0": "topic"}

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It mentions preserving formatting, which is a useful trait, but omits critical side effects such as whether the original file is modified, whether output_path is overwritten, or any error behavior.

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 a single, front-loaded sentence with no wasted words. Every component (action, resource, key behavior) earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has a complex replacement format with keys like p:0 and c:0:3:0, and optional fmt_hints with run-level formatting, yet the description provides no explanation of these or how formatting preservation actually works. It relies entirely on schema examples, leaving significant gaps for an agent to correctly invoke the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All four parameters have schema descriptions with examples, including the complex replacement map and fmt_hints. The tool description itself adds no additional parameter semantics, so a baseline score of 3 is appropriate given the high schema coverage.

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 the tool's function with a specific verb ('Replace') and resource ('text in a Word document'), plus a distinctive behavior ('preserving all formatting') that separates it from siblings like word_analyze and word_read_document.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as word_analyze, word_read_document, or word_clone_template. It simply states the action without any context, exclusions, or prerequisite conditions.

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/chunleiding/office-mcp-server'

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