Delete a text range
delete_rangeDeletes content in a Google Doc by specifying start and end indexes. Use fresh indexes from read_document_text because deletions shift later positions.
Instructions
Deletes the content in [start_index, end_index) — text, inline images, whole tables or any mix, as long as the range does not cut across a table cell boundary. Get fresh indexes from read_document_text first; every delete shifts all later indexes down. Deleting a paragraph's trailing newline merges it with the next paragraph. The tab's final newline cannot be deleted. This is final — there is no undo through the API.
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": {
"document_id": "<document_id>",
"start_index": "<start_index>",
"end_index": "<end_index>"
},
"name": "delete_range"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tab_id | No | Tab to target (from list_tabs). Omit for the first/only tab. | |
| end_index | Yes | End of the range to delete (exclusive). | |
| segment_id | No | Header/footer/footnote segment id (from get_document). Omit for the document body. | |
| document_id | Yes | The document id — the long id from the document URL (docs.google.com/document/d/<documentId>/edit) or from create_document output. | |
| start_index | Yes | Start of the range to delete (inclusive). |