MCP Server Office

edit_docx_paragraph

Make text replacements in specified paragraphs of a docx file. Accepts a list of edits with paragraph index and search/replace pairs. Each edit operates on a single paragraph and preserves the formatting of the first run. Returns a git-style diff showing the changes made. Only works within allowed directories.

Input Schema

NameRequiredDescriptionDefault
editsYesSequence of edits to apply to specific paragraphs.
pathYesAbsolute path to file to edit. It should be under your current working directory.

Input Schema (JSON Schema)

{ "properties": { "edits": { "description": "Sequence of edits to apply to specific paragraphs.", "items": { "properties": { "paragraph_index": { "description": "0-based index of the paragraph to edit. tips: whole table is count as one paragraph.", "type": "integer" }, "replace": { "description": "Text to replace the search string with. The formatting of the first run in the paragraph will be applied to the entire replacement text. Empty string represents deletion. Escape line break when you input multiple lines.", "type": "string" }, "search": { "description": "Text to find within the specified paragraph. The search is performed only within the target paragraph. Escape line break when you input multiple lines.", "type": "string" } }, "required": [ "paragraph_index", "search", "replace" ], "type": "object" }, "type": "array" }, "path": { "description": "Absolute path to file to edit. It should be under your current working directory.", "type": "string" } }, "required": [ "path", "edits" ], "type": "object" }