listHeadings
List a Google Docs document's headings with text, heading ID, level, and start index to inspect its outline, find sections to edit, or resolve link targets.
Instructions
Lists a document's headings — text, headingId, level, and start index — using a narrow field mask, so the response is proportional to the number of headings rather than to the size of the document. Use this to see a document's outline, to pick a section to edit (the start index feeds modifyText, deleteRange, and replaceRangeWithMarkdown; the headingId feeds replaceRangeWithMarkdown's headingId target), and to look up the heading ids that in-document links point at. TITLE counts as level 1 and SUBTITLE as level 2, matching the markdown export. headingId is null when Google Docs has not assigned one yet — it only assigns an id once a heading has been used as a link target — and this tool never invents one, because a made-up id would not resolve. Headings inside table cells are excluded: they are not part of the document outline. For full element-level addressing (list items, tables, per-cell indices) use readDocument with format='index'; for the document text use format='markdown'. This is a structure read only: it does not return document content and does not authorize a subsequent edit — call readDocument for that.
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": {
"documentId": "<documentId>"
},
"name": "listHeadings"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | No | The ID of the specific tab to list headings for. If not specified, lists the document body (the first tab on a tabbed document). | |
| documentId | Yes | The document ID — the long string between /d/ and /edit in a Google Docs URL. | |
| maxResults | No | Maximum number of headings to return (default 500). Exceeding it truncates in document order and says so. |