delete_doc_range
Deletes one or more content ranges from a Google Doc by start/end indices, applying deletions high-index-first so earlier positions stay valid; confirm indices first to avoid shifting errors.
Instructions
Delete one or more content ranges from a Google Doc.
All indices are interpreted as positions in the document before any of the deletions in this call. Deletions are applied high-index-first so earlier indices are not shifted by later ones.
Use get_doc_structure to obtain the correct start/end indices.
Args: doc_id: The Google Doc file ID. deletions: List of {"start_index": int, "end_index": int}. The range [start_index, end_index) is deleted (end_index is exclusive). Do not include the document's final newline (last endIndex - 1).
Returns: Confirmation with docId and count of deletions applied.
Note: Including a paragraph's trailing paragraph mark in the deleted range merges that paragraph into the next one, and the merged result inherits the next paragraph's style (e.g. deleting through a NORMAL_TEXT paragraph's newline when the following paragraph is HEADING_1 leaves the surviving content styled as HEADING_1). Text inserted afterward at that position silently picks up the same inherited style. Follow a paragraph-mark-inclusive delete with an explicit updateParagraphStyle (style_doc_range's named_style_type, or insert_softbreak_paragraph's named_style_type) rather than assuming the original style survived.
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>",
"deletions": "<deletions>"
},
"name": "delete_doc_range"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc_id | Yes | ||
| deletions | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||