Skip to main content
Glama

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

NameRequiredDescriptionDefault
tabIdNoThe ID of the specific tab to list headings for. If not specified, lists the document body (the first tab on a tabbed document).
documentIdYesThe document ID — the long string between /d/ and /edit in a Google Docs URL.
maxResultsNoMaximum number of headings to return (default 500). Exceeding it truncates in document order and says so.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv4.0.0-rc.1

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral burden and does so well. It discloses the narrow field mask and proportional response, TITLE/SUBTITLE level mapping, the headingId null when not assigned and the deliberate refusal to invent one, exclusion of headings inside table cells, and that this is a structure read only that does not authorize edits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and return shape, then moves through usage, level mapping, headingId caveats, exclusions, and alternatives. It is somewhat dense, but each sentence provides actionable context rather than restating the name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a no-annotation, no-output-schema tool, the description is complete: it covers return fields, level semantics, null headingId behavior, table-cell exclusions, maxResults truncation indirectly via the schema, alternatives, and the read-only scope. An agent has enough information to call it correctly and understand what it will and will not return.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so documentId, tabId, and maxResults are already fully explained. The description adds useful surrounding meaning about start index and headingId as outputs, but does not add parameter-specific semantics beyond the schema, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: lists a document's headings, with the returned fields enumerated (text, headingId, level, start index). It also distinguishes this from readDocument's full element-level and markdown views, so an agent can identify it without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit when-to-use cases: viewing an outline, picking a section to edit by feeding start index or headingId into modifyText/deleteRange/replaceRangeWithMarkdown, and looking up link-target heading ids. It also names alternatives for full addressing and document text using readDocument with format='index' or 'markdown'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools