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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"output_path": "<output_path>",
"replacements": "<replacements>"
},
"name": "word_replace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | source .docx path | |
| fmt_hints | No | optional JSON string with run-format hints, e.g.: {"_fmt:p:1": {"runs": [{"text": "中一", "underline": true}]}} | |
| output_path | Yes | where to save the new .docx | |
| replacements | Yes | JSON string with replacement map, e.g.: {"p:0": "new title", "c:0:3:0": "line1\nline2", "c:0:2:1:0": "topic"} |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||