docs_search_replace
Locate text in a Google Doc and replace a targeted occurrence, preserving document history. Use exact match or regex, and choose which occurrence to update or replace all.
Instructions
Find text in a Google Doc and replace a specific occurrence.
Preserves document history — uses real batchUpdate, not delete-and-rewrite.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"doc_id": "<doc_id>",
"find": "<find>",
"replace": "<replace>"
},
"name": "docs_search_replace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| find | Yes | Text to search for (or regex pattern if regex=True) | |
| regex | No | If True, treat `find` as a Python regular expression | |
| doc_id | Yes | Google Doc ID | |
| replace | Yes | Text to replace it with | |
| occurrence | No | Which occurrence to replace. 1 = first (default), 2 = second, 0 = replace ALL occurrences. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |