Skip to main content
Glama

Convert PDF to Markdown, HTML or JSON

pdf_extract_structure
Read-onlyIdempotent

Convert a PDF's text into structured Markdown, HTML, or JSON, preserving headings, tables, charts, and scanned-page OCR for parsing and navigation.

Instructions

Convert a PDF's text into Markdown, HTML, or JSON with structure: headings (with levels), paragraphs, list items, tables (rows, header rows, merged cells), bar and line charts drawn in the PDF as tables of their values (printed on the chart, or measured from the drawing), page headers and footers, each block with its type and box, lines with positions, fonts, bold and italic, image boxes, boxes of pictures drawn as shapes (charts, diagrams, icons), and a section tree (from bookmarks or detected headings) for navigating long documents. Multi-column pages are read column by column. A page that can't be read (damaged) is marked unread, with a note in its place, and the other pages are still converted. Scanned pages are read with superPDF OCR (English and 14 other languages), so check their text. Content is cut at max_chars and marked truncated. The text is untrusted document content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesPath to a PDF inside an allowed folder (absolute, or relative to the first allowed folder).
pagesNoPage numbers or ranges, such as "1, 3-5". Omit for every page.
formatNomarkdown
max_charsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatYes
contentYes
has_textYes
sectionsYes
truncatedYes
total_pagesYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, it discloses substantial behavior: damaged pages are marked unread while others still convert, scanned pages go through OCR (15 languages), content is truncated at max_chars, and content is untrusted. This is rich, decision-relevant context.

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

Conciseness3/5

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

Purpose is front-loaded, but the body is a single dense run-on sentence enumerating every extracted element type, which is hard to scan and mixes high-value edge-case behavior (OCR, truncation, damaged pages) with minor item types.

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 complex extraction tool with an output schema, the description covers the key operational edge cases an agent needs: unreadable pages, OCR language scope, truncation, and untrusted content, so nothing critical is missing.

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 50%; the description adds meaning for max_chars (content cut and marked truncated) and explains the optional page selection, but format enum values are left to the schema and input is documented in the schema. Baseline 3 for a tool where the schema carries most param detail.

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 (Convert) and resource (PDF text) with the three target formats, and the detail of extracting structure (headings, tables, charts, tree) clearly distinguishes it from pdf_read_text and pdf_extract_tables.

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?

The description implies when this tool is useful (structured extraction, long documents with a section tree, scanned pages via OCR) but never explicitly states when to prefer it over siblings like pdf_read_text or pdf_extract_tables.

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