Skip to main content
Glama

Extract PDF text

pdf_text_extract
Read-only

Extract plain text from a PDF by URL or base64 for AI agent use. Returns text up to a character limit; works on text-layer PDFs only, without OCR or table layout.

Instructions

Free, read-only. Extract plain text from a PDF given as a URL (max 20 MB) or inline base64 (max 5 MB), one of the two. Returns text, cut at maxChars with a marker. Text-layer PDFs only: scans return little or nothing (no OCR). Layout and tables are not preserved. Fails if the URL serves HTML, not a PDF.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "pdf_text_extract"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlNoDirect link to the .pdf file, not a viewer page. Not with data.
dataNoBase64 PDF, max 5 MB decoded. Not with url.
headersNoHeaders to forward (Authorization, Cookie…).
maxCharsNoOutput cap, chars. Default 20000, max 100000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.1.4
    • changedInput schema / properties / data / description
      Previous value: -"Base64 PDF, ≤5MB decoded (alt. to url)."New value: +"Base64 PDF, max 5 MB decoded. Not with url."
    • changedInput schema / properties / maxChars / description
      Previous value: -"Default 20000, max 100000."New value: +"Output cap, chars. Default 20000, max 100000."
    • changedInput schema / properties / url / description
      Previous value: -"PDF URL (alt. to data)."New value: +"Direct link to the .pdf file, not a viewer page. Not with data."
  2. Changed5 schema fields changedv0.1.1
    • addedInput schema / properties / data
      Added value: +{
      +  "description": "Base64 PDF, ≤5MB decoded (alt. to url).",
      +  "type": "string"
      +}
    • addedInput schema / properties / headers
      Added value: +{
      +  "description": "Headers to forward (Authorization, Cookie…).",
      +  "type": "object"
      +}
    • changedInput schema / properties / maxChars / description
      Previous value: -"Max characters to return (default 20000, max 100000)."New value: +"Default 20000, max 100000."
    • changedInput schema / properties / url / description
      Previous value: -"URL of the PDF to fetch (http/https). Must be a PDF file."New value: +"PDF URL (alt. to data)."
    • removedInput schema / required
      Removed value: -[
      -  "url"
      -]
  3. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnlyHint; the description adds the constraints that actually shape a call — 20 MB URL / 5 MB base64 caps, mutual exclusivity of the two inputs, truncation at maxChars with a marker, no OCR, no layout/table preservation, and the HTML-mislabeled-URL failure mode.

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?

Four short sentences, front-loaded with safety and scope, then inputs, then return behavior, then failure modes. No filler and nothing repeated from 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?

Covers what the tool returns (text, cut at maxChars with a marker) despite there being no output schema, and documents every behavioral risk of a 4-parameter extraction tool: size ceilings, input exclusivity, missing OCR, and non-preserved layout.

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 already 100%, so the baseline is 3; the description earns extra by adding size limits per input mode and confirming the url/data either-or that the schema only hints at, plus the truncation behavior tied to maxChars.

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 — extract plain text from a PDF — plus the two accepted input forms. The 'PDF' scope cleanly separates it from fetch_html, html_to_markdown and fetch_extract even though no sibling is named.

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?

Makes the applicable domain explicit ('Text-layer PDFs only: scans return little or nothing'), which tells the agent when not to call it, and 'Fails if the URL serves HTML, not a PDF' routes HTML content elsewhere. No sibling is named outright, so the routing is inferred rather than stated.

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