Skip to main content
Glama

PDF to text

pdf_to_text

Extract text from PDFs and save it as TXT or Markdown with headings and lists kept for reading or quoting; scanned PDFs without a text layer return an error.

Instructions

Save the text of a PDF as a .txt, or as .md with headings and lists kept. Use this to read or quote a PDF. A scanned PDF has no text layer and returns an error (OCR is at https://fizzdoc.com/ocr-pdf/). Returns the saved path; the input is not changed.

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": {
      "file": "<file>"
    },
    "name": "pdf_to_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileYesPath to the file (absolute, or relative to the working directory).
formatNo"txt" (default) or "md" for Markdown.
outputNoWhere to save the result. Defaults to a new file next to the input.

Output Schema

NameRequiredDescriptionDefault
notesYesAnything the output does not carry over from the input.
summaryYesOne line describing the result.
writtenYesPaths of the files written, in order.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.1.2

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare non-destructive, non-open-world behavior, and the description adds meaningful context beyond them: the input file is not modified, the result is written to a new path which is returned, and scanned inputs fail rather than producing empty output. It adds no detail on overwrite behavior when the output path already exists, which is the main remaining ambiguity for a write-adjacent tool.

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 front-loaded sentences with no filler: capability first, intended use second, failure mode and return value last. Every clause carries information an agent would otherwise have to guess.

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?

An output schema exists, yet the description still usefully mentions the returned path. Combined with the error case, input-preservation note, and format explanation, nothing an agent needs in order to call this correctly is missing.

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 baseline would be 3, but the description adds real meaning by explaining that "md" preserves headings and lists and that the default output is a new file. It does not explain the consequences of pointing `output` at an existing file, leaving the most risky parameter partially ambiguous.

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 ("Save the text of a PDF") plus the two output formats, and the line "Use this to read or quote a PDF" separates it from metadata tools like pdf_info and from the Office conversion siblings. An agent can identify the operation and output artifact without opening the schema.

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 a clear use case ("read or quote a PDF") and an explicit when-not case: scanned PDFs have no text layer and return an error, with a redirect to an OCR service. It stops short of naming sibling tools or stating what to do when the PDF is only partly text-based, so it is strong but not fully exhaustive.

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