Skip to main content
Glama

get_table_of_contents

Extract and navigate PDF table of contents to quickly locate chapters, sections, and specific content within documents using customizable depth and parent filtering.

Instructions

Get the table of contents (bookmarks/outline) from a PDF.

When max_level is not specified and the TOC is very large, the depth is automatically
reduced to keep the response manageable. The response will include an
``auto_trimmed_to_level`` field and a hint when this happens.

Args:
    filename: Path to a PDF file.
    parent: Return only children of the entry whose title contains this string
            (case-insensitive). For example, pass a chapter title to get its sections.
    max_level: Only include entries up to this depth (1=chapters only, 2=sections, etc.).
               When used with parent, levels are relative: 1 means direct children only,
               2 means children and grandchildren, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
parentNo
max_levelNo
Behavior4/5

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

With no annotations, description carries full burden and discloses important behavioral traits: automatic depth reduction for large TOCs and the presence of an auto_trimmed_to_level response field. However, omits discussion of error conditions (missing file, malformed PDF) or idempotency guarantees.

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?

Well-structured with purpose front-loaded, followed by behavioral note, then structured Args documentation. No wasted words. Minor improvement possible: the auto-trimming sentence could be split for clarity, but overall efficient for the information density provided.

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?

Given zero schema coverage, no annotations, and no output schema, the description achieves strong completeness by documenting the output field auto_trimmed_to_level and explaining parameter interactions. Would benefit from brief note on return structure format (array/tree).

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

Parameters5/5

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

Excellent compensation for 0% schema coverage. Args section provides rich semantics for all 3 parameters: filename is clarified as 'Path to a PDF file'; parent includes filtering logic, case-sensitivity note, and concrete example ('pass a chapter title'); max_level includes numeric mapping (1=chapters) and relative behavior with parent.

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?

Description opens with specific verb+resource: 'Get the table of contents (bookmarks/outline) from a PDF.' This clearly distinguishes from siblings like get_page_text (content extraction) and get_pdf_info (general metadata) by specifying navigation structure extraction.

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

Usage Guidelines3/5

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

Provides implicit guidance through explaining auto-trimming behavior when max_level is omitted and complex interactions between parent/max_level parameters. However, lacks explicit 'when to use vs alternatives' (e.g., when to prefer this over get_pdf_info for document structure).

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/I-CAN-hack/pdf-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server