Skip to main content
Glama

Agent Data Hub

PDF to text: extract text from a PDF URL, page by page

page_pdf_text
Read-onlyIdempotent

Download a PDF from a public URL (max 20 MB, 300 pages per call) and return its text layer as clean UTF-8: full text plus per-page text, page count, title, author, creation date and word count. Choose pages with 'pages' (e.g. 1-3,7) and cap output with max_chars (default 100,000) to fit your context window. Use for research papers, reports, invoices, contracts, manuals, government filings. Scanned image-only PDFs return has_text_layer=false (no OCR). Password-protected PDFs are refused (no charge). Price: $0.005 per call (USDC on Base via x402); the first 10 calls per day are free.

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": {
      "url": "<url>"
    },
    "name": "page_pdf_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesPublic URL of the PDF file
pagesNoOptional pages to return, e.g. 1-3,5 (default all, max 300)
max_charsNoOptional max characters returned, 1000–500000 (default 100000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already cover read-only, idempotent, open-world, non-destructive, so the extra burden here is heavy — and the description meets it: 20 MB and 300-page limits, no-OCR behavior surfaced via has_text_layer=false, password-protected refusal (and that it is not charged), plus price ($0.005/call) and a 10-call/day free tier. That is exactly the kind of operational context annotations cannot carry.

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 dense sentences: capability and return shape first, parameters and context-window rationale second, caveats and pricing last. Nothing is redundant with the title, and no sentence could be dropped without losing a decision-relevant fact.

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?

There is no output schema, yet the description enumerates the returned fields (full text, per-page text, page count, title, author, creation date, word count) and the has_text_layer flag, and it covers size limits, failure modes, and cost. For a three-parameter extraction tool, an agent has everything needed to call it and interpret the result.

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

Parameters4/5

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

Schema coverage is 100%, so a 3 is the baseline; the description earns a bump by adding the purpose behind max_chars ('to fit your context window') and by restating page selection as a worked example. The added meaning is real but thin, since the schema already supplies defaults and the '1-3,5' example.

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 pair ('Download a PDF from a public URL ... return its text layer as clean UTF-8') plus the exact shape of the result, so it is unambiguous against siblings like page_html_to_markdown or page_text. An agent can tell instantly that this is the PDF path, not the HTML path.

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?

Gives concrete when-to-use targets ('research papers, reports, invoices, contracts, manuals, government filings') and explicit exclusion conditions: scanned image-only PDFs return has_text_layer=false with no OCR, and password-protected PDFs are refused. It stops short of naming a sibling alternative to use instead when OCR or HTML is needed, so usage routing is clear but not fully closed.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources