search_and_replace
Batch find and replace in Word documents across body, footnotes, headers, or all, with preview dry-runs, formatting-restricted replacements, tracked changes, and safety limits.
Instructions
Batch find/replace, safe across Word's fragmented runs. Each item: {find, replace, regex?}; scope: body | footnotes | headers | all. preview=true dry-runs the same engine without touching the file: per-item counts, each match with paragraph index and before/after context, the grand total, and the refusals a real run would hit; review, then rerun with max_replacements set to the previewed total so drift aborts instead of over-replacing. find_formatting={bold, italic, font, size_pt, color, highlight, style, ...} restricts replacement to text carrying that effective formatting (file mode only, no regex; an item without find replaces each entire matching stretch, and the replacement keeps the matched formatting). max_replacements aborts, changing nothing, when total matches would exceed it. track records each replacement as a tracked change by author. Sibling: set_paragraph_text rewrites one whole paragraph when a find string would be unwieldy. Live edits appear immediately as one Ctrl+Z step, unsaved until the user saves; the live result adds live:true and skip counters, and literal finds beyond Word's ~255-char limit are handled automatically. Auto-backup in file mode (backup=False skips rotation); atomic validated save. Documents open in Word edit live, serialized; tracked replaces never re-match their own markup. For anchor-scoped edits, use apply_edits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| live | No | auto | |
| scope | No | body | |
| track | No | ||
| author | No | Claude | |
| backup | No | ||
| preview | No | ||
| file_path | Yes | ||
| replacements | Yes | ||
| find_formatting | No | ||
| max_replacements | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||