Skip to main content
Glama

readfetch_pdf

Read-only

Extract text from a PDF (%PDF- magic, not Content-Type). Send exactly one of url (public http(s) link — egress GET, ≤ 20 MB) or content_base64 (bytes you already have, ≤ 20 MB decoded; optional filename labels the upload). Returns pages (per-page text), one concatenated markdown body, title, and metadata; $0.005 per document, not per page. max_pages limits extraction (default 50, max 200); documents over 200 pages or above your cap return 413 and are not billed. Scanned/image-only PDFs may return empty text with billed: false and a hint. Prefer readfetch_text or readfetch_scrape for HTML articles; readfetch_fetch for raw PDF bytes without extraction; readfetch_batch for many HTML URLs, not PDFs. Read-only server-side; paid x402 like other routes.

Input Schema

NameRequiredDescriptionDefault
urlNoPublic PDF URL; fetched through egress (≤ 20 MB). Mutually exclusive with content_base64.
filenameNoOptional label when using content_base64 (default upload.pdf); ignored for url-only requests.
max_pagesNoExtract at most this many pages. Default 50; raise up to 200 when the document is longer. Over cap → 413, unbilled.
content_base64NoBase64-encoded PDF bytes (≤ 20 MB). Mutually exclusive with url; pair with filename when the label matters.

Output Schema

NameRequiredDescriptionDefault
hintNo
pagesNo
titleNo
billedNo
sourceNo
statusNo
markdownNo
metadataNo
page_countNo
content_sha256No

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / hint / type
      Previous value: -"null"New value: +[
      +  "string",
      +  "null"
      +]
  2. Changed5 schema fields changed
    • changedInput schema / properties / content_base64 / description
      Previous value: -"Inline PDF, up to 20 MB."New value: +"Base64-encoded PDF bytes (≤ 20 MB). Mutually exclusive with url; pair with filename when the label matters."
    • addedInput schema / properties / filename / description
      Added value: +"Optional label when using content_base64 (default upload.pdf); ignored for url-only requests."
    • addedInput schema / properties / max_pages / description
      Added value: +"Extract at most this many pages. Default 50; raise up to 200 when the document is longer. Over cap → 413, unbilled."
    • changedInput schema / properties / url / description
      Previous value: -"PDF URL, fetched through egress."New value: +"Public PDF URL; fetched through egress (≤ 20 MB). Mutually exclusive with content_base64."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "billed": {
      +      "type": "boolean"
      +    },
      +    "content_sha256": {
      +      "type": "string"
      +    },
      +    "hint": {
      +      "type": "null"
      +    },
      +    "markdown": {
      +      "type": "string"
      +    },
      +    "metadata": {
      +      "properties": {
      +        "author": {
      +          "type": "string"
      +        },
      +        "created": {
      +          "type": "string"
      +        },
      +        "producer": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "page_count": {
      +      "type": "integer"
      +    },
      +    "pages": {
      +      "items": {
      +        "properties": {
      +          "page": {
      +            "type": "integer"
      +          },
      +          "text": {
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "source": {
      +      "format": "uri",
      +      "type": "string"
      +    },
      +    "status": {
      +      "type": "string"
      +    },
      +    "title": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  3. Changed1 schema field changed
    • removedInput schema / properties / egress
      Removed value: -{
      -  "description": "Exit to leave through: `direct` (this service's own datacentre egress) or `residential` (a residential address pool, for targets that refuse datacentre addresses). Omit to use the default route.",
      -  "title": "Egress",
      -  "type": "string"
      -}
  4. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the readOnlyHint/openWorldHint annotations: pricing ($0.005 per document, not per page), 20 MB limits, egress GET for URLs, 413 on page-cap overflow with no billing, and the scanned-PDF failure mode returning empty text with billed:false and a hint. The paid x402 model is also disclosed.

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 purpose, then input contract, then returns, then costs/limits, then alternatives — a sound ordering with no filler sentences. The semicolon-chained clauses pack several facts per sentence, which slightly reduces scannability and repeats limits already in the schema.

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?

Even though an output schema exists, the description names the shape of the return (pages, markdown, title, metadata) and covers the failure paths and cost model an agent needs before calling. Nothing required for a correct invocation 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% and the schema already documents mutual exclusivity, size caps, defaults and the 413 outcome, so the description largely restates it. The only genuinely new framing is the egress-GET nature of `url` and 'optional filename labels the upload', which the schema already implies.

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?

Opens with a specific verb+resource ('Extract text from a PDF') plus a distinguishing technical detail (%PDF- magic, not Content-Type). It explicitly separates itself from readfetch_text/scrape (HTML), readfetch_fetch (raw bytes), and readfetch_batch (not PDFs), so the agent can route without opening any schema.

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

Usage Guidelines5/5

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

Gives explicit alternatives with their selection conditions: 'Prefer readfetch_text or readfetch_scrape for HTML articles; readfetch_fetch for raw PDF bytes without extraction; readfetch_batch for many HTML URLs, not PDFs.' It also states the either/or input contract ('Send exactly one of url or content_base64').

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