create_named_range
Creates a named range over a Google Doc span for later API reference by name, avoiding manual index tracking as content shifts.
Instructions
Create a named range over a span of content in a Google Doc.
A named range lets you reference a section of the document by name later (e.g. with ReplaceNamedRangeContentRequest via batch_update) without tracking raw indices yourself — the Docs API automatically shifts the range's bounds as content is inserted or deleted elsewhere in the doc.
Use get_doc_structure to find start/end indices for the target span.
Args: doc_id: The Google Doc file ID. name: Name for the range. Not required to be unique; 1-256 UTF-16 code units. start_index: Start of the range (inclusive). end_index: End of the range (exclusive).
Returns: Confirmation with docId, namedRangeId, name, startIndex, endIndex.
Note: Named ranges are not visible in the Docs UI and cannot be used as internal hyperlink targets (the Link object only supports UI-created bookmarks and headings, not named ranges) — they exist purely for programmatic reference via 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": {
"doc_id": "<doc_id>",
"name": "<name>",
"start_index": "<start_index>",
"end_index": "<end_index>"
},
"name": "create_named_range"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| doc_id | Yes | ||
| end_index | Yes | ||
| start_index | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||