Skip to main content
Glama

PDF to Markdown

ai_pdf_to_markdown
Read-onlyIdempotent

Convert text PDFs into structured Markdown with headings, paragraphs, and lists, plus optional page ranges and page markers; scanned PDFs require OCR first.

Instructions

Convert a text PDF to structured Markdown: headings guessed from font size (text clearly larger than the body becomes #, ##, ###), paragraphs rebuilt from line spacing with hyphenated words mended, bullet and numbered lists kept, right-to-left lines in reading order. Optional page range ("1-5, 8") and page markers. Scanned PDFs without a text layer give empty pages (listed in pagesWithoutText; run OCR first). Tables and columns are read line by line. Accepts a local path or base64. Inline Markdown is cut at maxChars (default 200k); "output" saves it to a file.

Input Schema

NameRequiredDescriptionDefault
fileYesThe PDF: a local file path (absolute, or relative to the server's --root) or base64 data (raw or a data: URI).
pagesNoPages to convert, e.g. "1-3, 7" or "5-" (1-based). Default: all.
outputNoWrite the Markdown to this file (or folder ending in "/") and return its path instead of the inline text.
maxCharsNoCut the inline Markdown after this many characters, with a note (a file written with "output" is never cut). Default 200000.
passwordNoPassword, if the PDF is protected.
pageMarkersNoPut "<!-- Page N -->" before each page and "---" between pages. Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior1/5

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

The description says the optional `output` parameter saves Markdown to a file, which is a write to the environment. This contradicts the annotation readOnlyHint=true, so the description and structured metadata conflict. Otherwise the behavioral detail about truncation, page markers, and empty pages is rich, but the contradiction takes precedence.

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 and dense with useful specifics rather than filler. It is somewhat long for a single paragraph and includes minor repetition of schema details, but the length is justified by the tool's behavioral complexity.

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 tool with no output schema and six parameters, the description covers the key return behavior (inline Markdown or file path), truncation via maxChars, page filtering, page markers, and the scanned-PDF edge case including the pagesWithoutText signal. An agent has enough context to invoke it correctly.

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 every parameter is already documented in the schema. The description reinforces page ranges, page markers, maxChars truncation, and output-file behavior, but adds little semantic detail beyond the schema descriptions.

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 (convert a text PDF to structured Markdown) and immediately characterizes the output structure. It clearly distinguishes the tool from OCR by explaining that scanned PDFs without a text layer produce empty pages and should be OCR'd first.

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

Usage Guidelines4/5

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

It gives clear usage context for text PDFs and explicitly redirects scanned PDFs to OCR first. It does not explicitly compare against sibling conversion tools such as pdf_to_text, so it falls short of full alternative routing.

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