Skip to main content
Glama

word_find_replace

Replace all occurrences of a specified string in a Word document. Control case sensitivity and get the count of replacements.

Instructions

Replace every occurrence of find with replace.

Operates on every body paragraph. The reported replacements count is the sum of occurrences across all paragraphs before the replacement is applied (case-sensitivity follows the case_sensitive flag).

Args: path: Path to an existing .docx. find: The literal string to search for. Must be non-empty. replace: The replacement string. case_sensitive: When True (default), the match is exact; when False, the match is case-insensitive. folder: Optional base folder for relative paths.

Returns: {"replacements": <n>}.

Raises: OfficeMCPError: ERR_INVALID_PARAMS if find is empty or non-string, ERR_FILE_NOT_FOUND if the file is missing, ERR_UNSUPPORTED_FMT for non-.docx extensions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
findYes
replaceYes
case_sensitiveNo
folderNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

With no annotations, the description carries the burden. It details operation scope (all body paragraphs), case sensitivity, replacement count semantics, and error conditions. However, it does not clarify if the file is saved automatically or requires explicit save.

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

Conciseness4/5

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

The description is well-structured with Args, Returns, and Raises sections. It is front-loaded with the main action but could be slightly more concise by removing minor redundancy.

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 the 5 parameters, output schema, and error handling, the description covers most essential aspects. It lacks explicit mention of file saving behavior, but overall it is complete enough for correct usage.

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 coverage is 0%, so the description provides all parameter meaning (path to existing docx, find non-empty literal, replace string, case_sensitive behavior, optional folder). This adds significant value beyond the minimal schema.

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 replaces occurrences of a string in a .docx file, operating on body paragraphs. It uses a specific verb-resource combination and distinguishes from sibling tools like search_text.

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?

The description implies usage for find-and-replace in Word documents, but lacks explicit guidance on when not to use it or alternatives. It is clear enough for selection but could benefit from mentioning siblings like search_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/gawirable/office-mcp'

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