Skip to main content
Glama

Extract text

extract_text
Read-only

Extract the text layer of a PDF as plain text, page by page and in reading order. Use it to read, summarize, quote, or copy document content.

Instructions

Extracts the text layer of a PDF and returns it as plain text, one "--- Page N ---" section per page, in reading order. Use it to read, summarize or quote a document; to find where a word occurs, search_pdf is faster, and for tables export_table keeps rows and columns. Scanned pages have no text layer and come back marked as empty: run recognize_text on the file first, then extract from its output. Encrypted PDFs need their password. Very long documents stop after about 400,000 characters with a note; ask for fewer pages. Read-only; the file is not changed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path of the PDF.
pagesNoPages as 1-based numbers and ranges, e.g. "1-3,5". All pages when omitted; a page outside the document is an error.
passwordNoPassword, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.0.9
    • changedInput schema / properties / pages / description
      Previous value: -"Pages, e.g. \"1-3,5\" (1-based). All pages when omitted."New value: +"Pages as 1-based numbers and ranges, e.g. \"1-3,5\". All pages when omitted; a page outside the document is an error."
    • changedInput schema / properties / password / description
      Previous value: -"Password, if the PDF is encrypted."New value: +"Password, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it."
  2. First observedv1.0.6

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint, but the description adds substantial behavioral detail: the exact output framing, empty results for scanned pages with the recovery path, the ~400,000-character truncation cap with a note, and that encrypted files need a password. That is exactly the extra 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?

Four dense sentences, zero filler, with the core purpose front-loaded and alternatives, edge cases, and limits following in a logical order. Every sentence carries actionable information.

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, so the description must describe the return value — and it does precisely, including per-page delimiters ordering, the empty-page marker, and the truncation behavior. Edge cases (scanned, encrypted, oversized) are all covered.

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%, so path, pages range syntax, and password behavior are already fully documented in the schema; the baseline is 3. The description reinforces password semantics ('encrypted PDFs need their password') but adds no syntax or format detail beyond what the schema provides.

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 (extracts the text layer of a PDF) plus the return format (plain text, '--- Page N ---' sections, reading order). It explicitly distinguishes itself from siblings search_pdf and export_table, so an agent can route correctly 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 when-to-use ('read, summarize or quote a document') and names the alternatives with their selecting conditions (search_pdf for locating words, export_table for tables). It also documents the prerequisite for scanned files (run recognize_text first) and the password requirement for encrypted PDFs.

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