process_document_batch
Apply batch edits to DOCX files: search-and-replace text, accept or reject tracked changes, reply to comments, and insert or delete table rows.
Instructions
Applies a batch of structural edits, text modifications, and review actions to a document. This is your primary tool for editing DOCX files.
CRITICAL: All changes in the batch evaluate against the ORIGINAL document state. Do not send sequential edits that depend on each other within the same batch (e.g. rename X to Y, then modify Y). Instead, apply the rename in one batch, then modify Y in a subsequent batch.
The changes parameter is a list of operations. Each item MUST have a type:
'modify': Search-and-replace text. Provide exact
target_text(CRITICAL: include surrounding context if the word appears multiple times to ensure unique matching) andnew_text(the replacement).new_textsupports full Markdown structure: '# Heading 1' through '###### Heading 6' at the start of a line for heading styles, 'bold' and 'italic' inline formatting, and blank lines ('\n\n') to splitnew_textinto multiple paragraphs. Multi-paragraph inserts are tracked as one logical revision. To delete text, makenew_textempty. Do NOT manually write CriticMarkup tags ({++, {--, {>>). To add a comment, use the 'comment' parameter.'accept': Finalize a tracked change. Requires
target_id(e.g., 'Chg:12'). (Note: Accepting one half of a paired modify cascades to accept the other half).'reject': Revert a tracked change. Requires
target_id(e.g., 'Chg:12'). (Note: Rejecting one half cascades to reject the other half).'reply': Reply to a comment. Requires
target_id(e.g., 'Com:5') andtext.'insert_row': Insert table row. Requires
target_text(anchor),position('above'/'below'), andcells(Markdown strings).'delete_row': Delete table row. Requires
target_textinside the row to be deleted.
Always provide a realistic author_name for Tracked Changes. This name will be used for attribution in the document's tracked changes and comments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| original_docx_path | Yes | Absolute path to the source file. | |
| author_name | Yes | Name to appear in Track Changes (e.g., 'Reviewer AI'). | |
| changes | Yes | List of changes to apply. Each change must specify 'type'. | |
| output_path | No | Optional output path. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |