Edit a Google Doc in place
update_docEdit Google Docs with exact text replacements, whole-body rewrites, or dropdown updates. Reports match counts and requires confirmation before destructive rewrites.
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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "update_doc"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docUrl | No | a Google Docs URL — the id is extracted from it | |
| confirm | No | true runs a whole-body rewrite after the character count is shown | |
| 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 |