Skip to main content
Glama

get_document_structure

Extract a document's hierarchical outline with headers, sections, and page references to locate relevant sections before fetching page content. Paginate large outlines as needed.

Instructions

Extract a document's hierarchical outline (headers, sections, page references). REQUIRED for documents over 20 pages — call this first to locate relevant sections, then pass their page numbers to get_page_content(). Use the part parameter to iterate large outlines until pagination.has_more is false.

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_name": "<doc_name>"
    },
    "name": "get_document_structure"
  }
}

Input Schema

NameRequiredDescriptionDefault
partNoPart number for pagination (1-based, default 1). For large outlines, increment until the response's `pagination.has_more` becomes false.
doc_nameYesCopy the `name` field verbatim from a browse_documents() or search_documents() response (case-sensitive, include extension). Example: "Q3 Report.pdf". If the response shows two documents with the same name, pass `folder_id` alongside to disambiguate.
folder_idNoDisambiguator for same-name documents. Copy the `folder_id` from the intended browse/search result; use "root" for root-level documents, or "shared-with-me"/"following" for the read-only folders at the library root; omit if `doc_name` is unique. Copy any folder_id verbatim from a browse_documents()/get_folder_structure() response, never construct one.
wait_for_completionNoIf true and document is processing, automatically wait up to 3 minutes until completed. Reduces repeated tool calls.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.9.0
    • addedInput schema / properties / folder_id / description
      Added value: +"Disambiguator for same-name documents. Copy the `folder_id` from the intended browse/search result; use \"root\" for root-level documents, or \"shared-with-me\"/\"following\" for the read-only folders at the library root; omit if `doc_name` is unique. Copy any folder_id verbatim from a browse_documents()/get_folder_structure() response, never construct one."
    • addedInput schema / properties / folder_id / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  2. First observedv1.8.2

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does disclose the key traits: the outline is paginated via `part` and the agent must loop until `pagination.has_more` is false, plus the sequencing rule for long documents. It stops short of stating failure modes (e.g. what happens on an unprocessed document, cost/latency), so it is strong but not exhaustive.

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

Conciseness5/5

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

Three short sentences, front-loaded with the capability, then the mandatory precondition, then the pagination rule. No filler or hedging; each sentence carries a distinct instruction.

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

Completeness4/5

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

For a four-parameter read tool with no output schema, the description covers purpose, workflow sequencing, and pagination termination, which is what an agent needs to invoke it correctly. It leaves open whether the tool is permitted (or advisable) for documents under 20 pages, a small but real gap.

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 coverage is 100%, so all four parameters are already documented in the input schema. The description's mention of `part` iteration largely restates the schema text; its only added meaning is tying the returned page numbers to the next call. 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?

States a specific verb and resource: 'Extract a document's hierarchical outline (headers, sections, page references).' The parenthetical enumerates exactly what comes back, which cleanly separates it from siblings like get_document (full text) and get_page_content (single page).

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?

Gives an explicit trigger ('REQUIRED for documents over 20 pages') and an explicit follow-on step: locate sections here, then pass page numbers to `get_page_content()`. This is a complete when-to-use plus named-alternative workflow, not an inference the agent has to make.

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