Skip to main content
Glama

pdf_to_text

Extract selectable plain text from born-digital PDFs and optionally save it as a .txt file. Use OCR tools for scanned-image PDFs.

Instructions

Extract plain text from a born-digital PDF using PyMuPDF.

**born-digital PDF only** (text that can be selected/copied with a mouse).
Scanned-image PDFs will return an empty string — use ``ocr_document``
for those.

Args:
    file_path: Absolute path to the .pdf file.
    save_text: If True (default), also writes a .txt file alongside the PDF.

Input Schema

NameRequiredDescriptionDefault
file_pathYes
save_textNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations present, the description carries the full burden and does well: it discloses failure behavior (empty string for scanned PDFs), a side effect (writes a .txt file alongside the PDF when save_text is true), and the default. It doesn't mention overwrite behavior for the .txt file, encoding, or size/permission constraints.

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?

Front-loads the core action, immediately follows with the critical constraint and the alternative, then a compact Args block. No filler sentences; every line carries information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and the description covers the return value (plain text; empty string on scanned input) and the file side effect, which is what an agent needs. It stops short of details like output filename conventions or error conditions for invalid paths.

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 description coverage is 0%, so the description must compensate — and it does, documenting both parameters: file_path as an absolute path to a .pdf, and save_text's default plus its observable side effect (a .txt written alongside the PDF). Minor gaps remain (relative-path handling, overwrite of an existing .txt).

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+resource ('Extract plain text from a born-digital PDF') and names the underlying library, so the operation is unambiguous. It also implicitly distinguishes itself from the OCR sibling by scoping to selectable-text PDFs.

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 an explicit use condition ('born-digital PDF only – text that can be selected/copied') and an explicit anti-condition with the named alternative ('Scanned-image PDFs will return an empty string — use ocr_document for those'). An agent can route correctly without inference.

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