Edit a Google Doc in place
update_docEdit Google Docs safely: replace exact text, rewrite the whole body, or set dropdown chips, with match counts and confirmation for destructive changes.
Instructions
EDIT a Google Doc — the correction append_to_doc cannot make. Two shapes: replacements:[{find, replace}] rewrites specific text wherever it appears (call read_doc first and match the text EXACTLY; matchCase:false ignores case), or rewrite:"…" replaces the ENTIRE body (rewrite:"" empties it), or dropdowns:[{title, value}] sets a dropdown chip (e.g. Status -> Approved — read_doc lists every chip with its options; pass dropdownId when two share a title; an unknown title or option is refused with the real list and nothing changes); the same entry with options:[…] (the COMPLETE new list, 2–50) and/or newTitle changes the dropdown itself for every chip built from it, and an option you drop that a chip shows needs replace:{"Old":"New"}. Find/replace runs immediately and REPORTS how many occurrences changed — zero matches is reported as a FAILURE to match, never as a quiet success, because a text edit that silently does nothing is worse than one that visibly fails. A whole-body rewrite is destructive: call it without confirm first to get the character count, then confirm:true + confirmCells. Both are index-free by design — an agent cannot reliably compute Google’s character offsets, and a wrong offset deletes the wrong sentence.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docUrl | No | a Google Docs URL — the id is extracted from it | |
| confirm | No | ||
| rewrite | No | replace the WHOLE body with this text ("" empties the doc) | |
| dropdowns | No | dropdown chips to set, or dropdowns to change | |
| documentId | No | the document id (from create_doc, or list_drive_files for one the user picked) | |
| confirmCells | No | echo back the character count the unconfirmed call reported (rewrite only) | |
| replacements | No | find/replace pairs, applied in order |