word_patch_with_track_changes
Replace text in Word documents with track changes enabled, creating revision marks that show deletions and insertions for auditable review.
Instructions
Replace text in a document with Word Track Changes enabled.
Creates revision marks (insertions/deletions) that appear in Word's review mode. Old text is marked as deleted (red strikethrough) and new text is marked as inserted (green underline).
This is useful for:
Auditable document changes
Review workflows where changes need approval
Comparing before/after states in Word
Example: patch_with_track_changes( file_path="04. Artifacts/contoso-sow.docx", replacements={ "": "Contoso Ltd", "": "Cloud Migration", "[TBD]": "Q1 2026" }, author="Solution Architect" )
Args: file_path: Path to the .docx document replacements: Dictionary mapping old text to new text author: Name to attribute changes to (appears in Word's review pane) output_path: Optional output path (defaults to overwriting input)
Returns: Status with replacement counts
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the .docx document | |
| replacements | Yes | Dictionary mapping old text to new text | |
| author | No | Name to attribute changes to (appears in Word's review pane) | |
| output_path | No | Optional output path (defaults to overwriting input) |