Skip to main content
Glama

PDF to text

pdf_to_text
Read-onlyIdempotent

Extract text from PDFs with paragraphs and right-to-left lines rebuilt as plain text or Markdown, including page ranges and passwords; flags scanned pages without a text layer (no OCR).

Instructions

Extract the text of a PDF with lines and paragraphs rebuilt (right-to-left Arabic/Hebrew lines in reading order), as plain text or Markdown, with optional page separators and reflow (join lines, mend hyphenated words). Returns per-page word counts and flags pages with no text layer (scans: this tool does no OCR). Supports page ranges and passwords. Give "output" to write a .txt/.md file instead of returning the text inline. Web version: https://s3eidat.github.io/pdf-to-text/

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 read: 1-based list like "1-3, 5, 8-" ("5-" = to the end, "-3" = first three, "3-1" = reversed). Also "all", "odd", "even", "last". Empty = all pages.
formatNo"text" or "markdown" (## Page N headings, reflowed paragraphs).text
outputNoWrite the text to this file (or folder ending in "/") instead of returning it inline.
reflowNoJoin the lines of each paragraph and mend words split by a hyphen.
perPageNoAlso return each page's text separately.
maxCharsNoCut the inline text after this many characters (the file output is never cut).
passwordNoPassword, if the PDF is protected.
separatorsNoPut a "——— Page N ———" line before each page. Default true.

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 annotations (readOnly/idempotent/closed-world), the description discloses the no-OCR limitation, that text-layer-missing pages get flagged, that per-page word counts are returned, that `output` writes a file instead of returning inline, and that maxChars truncation applies only to inline text. This is exactly the behavioral context an agent needs before calling.

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?

Front-loaded with the core action and feature set in a dense but readable block; every clause carries information. It is a single run-on sentence chain, though, and the trailing marketing URL is not useful to an agent.

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?

With 9 parameters, no output schema, and annotations covering only safety, the description fills the remaining gaps: return shape (text plus per-page counts and warning flags), output modes (inline vs file), and the OCR boundary. Nothing essential to a correct call 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 description coverage is 100%, so every parameter is already documented; the description's mentions of `output`, `reflow`, and separators restate schema content. The one added nuance is that copying to a file bypasses maxChars truncation, but that is also in the schema. Baseline 3 applies.

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

Purpose4/5

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

Specific verb and resource ('Extract the text of a PDF') plus concrete differentiating capabilities: line/paragraph rebuilding, RTL reading order, text vs Markdown, page ranges. It also rules out OCR, which implicitly distinguishes it from ai_ocr. It does not, however, name the closest sibling ai_pdf_to_markdown, whose overlap with the `format: markdown` option an agent would have to infer.

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?

Clear context: use it for text-layer PDFs, with an explicit exclusion for scans ('this tool does no OCR') and a note that scans are flagged. The main gap is that the alternative tool (ai_ocr for image-only PDFs, ai_pdf_to_markdown for markdown output) is never named, leaving the agent to infer 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