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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| find | Yes | ||
| replace | Yes | ||
| case_sensitive | No | ||
| folder | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||