replace_text
Replace text within a paragraph identified by its _bk_* ID, preserving all run-level formatting. Works with DOCX files and Google Docs.
If a search fails because the target text is fragmented across multiple adjacent runs with identical formatting, set
normalize_first: true. This merges those runs before searching, then restores them afterward.Path to the DOCX file. Provide either
file_path or google_doc_id.Google Doc ID or URL. Extract the ID from the URL:
docs.google.com/document/d/{ID}/edit.The
_bk_* paragraph ID returned by read_file or grep.The exact text to find within the target paragraph.
The replacement text.
A plain-language description of the change. Stored in the edit history for auditing.
Merge format-identical adjacent runs before searching, then restore them. Useful when text is fragmented across runs.
insert_paragraph
Insert a new paragraph immediately before or after an anchor paragraph identified by its _bk_* ID. Works with DOCX files and Google Docs.
Path to the DOCX file. Provide either
file_path or google_doc_id.Google Doc ID or URL. Extract the ID from the URL:
docs.google.com/document/d/{ID}/edit.The
_bk_* paragraph ID that determines the insertion position.Text content of the new paragraph.
A plain-language description of the change. Stored in the edit history for auditing.
Where to insert the paragraph relative to the anchor. Either
BEFORE or AFTER.A
_bk_* paragraph ID whose formatting (pPr and template run) the new paragraph should clone, instead of copying from the anchor. Falls back to the anchor with a warning if the ID is not found.accept_changes
Accept all tracked changes in the document body, producing a clean document with no revision markup. Returns acceptance statistics.
Path to the DOCX file.
format_layout
Apply layout controls including paragraph spacing, table row height, and cell padding. Google Docs supports paragraph spacing only.
Path to the DOCX file. Provide either
file_path or google_doc_id.Google Doc ID or URL. Extract the ID from the URL:
docs.google.com/document/d/{ID}/edit.When
true, fails on any layout value that cannot be applied exactly.Configure spacing for one or more paragraphs. All sub-fields are optional.
Configure height for table rows. All sub-fields are optional.
Configure padding for table cells. All sub-fields are optional.
clear_formatting
Clear specific run-level formatting properties from paragraphs. When no paragraph_ids are provided, the operation applies to every paragraph in the document.
Path to the DOCX file.
_bk_* paragraph IDs to target. If omitted, clears formatting from all paragraphs.Remove highlight formatting.
Remove bold formatting.
Remove italic formatting.
Remove underline formatting.
Remove font color.
Remove font family and size.
save
Save the current document state to disk. For DOCX files, you can save a clean version, a tracked-changes version, or both. For Google Docs, the default behavior creates a checkpoint and returns the revisionId; passing a local path exports the document as DOCX.
Path to the DOCX file. Provide either
file_path or google_doc_id.Google Doc ID or URL. Extract the ID from the URL:
docs.google.com/document/d/{ID}/edit.Destination path for the saved file.
Strip internal
_bk_* bookmark annotations from the saved output.What to save. One of
clean (no revision markup), tracked (all edits as tracked changes), or both (saves two files).When
true, overwrites an existing file at save_to_local_path. Defaults to false.Destination path for the tracked-changes output when
save_format is both.Author name attributed to tracked changes in the output.
Comparison engine used to generate tracked changes. One of
auto or atomizer.When
true, returns an error instead of saving if the comparison engine falls back to rebuild mode, which destroys table structure. Defaults to false.
