Skip to main content
Glama

Extract text

pdf_extract_text

Extracts a PDF text layer to a .txt file and returns per-page character counts; optionally includes text in results when requested for context.

Instructions

Extract the text layer to a .txt file and return per-page character counts. The text is NOT returned by default — set inline=true only if the caller really needs the content in its context (it then lands in the model provider logs).

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": {
      "path": "<path>"
    },
    "name": "pdf_extract_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
outNooutput .txt path
pathYes
pagesNo1-based page numbers. Omit for all pages.
inlineNoalso return the text in the tool result (opt-in)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.4

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does substantial work: it discloses that output is written to a file rather than returned, that content is withheld by default, and that opting in pushes text into model provider logs -- a real privacy/cost consequence an agent must know. Gaps remain around failure modes (scanned or encrypted PDFs) and whether out defaults to a derived path.

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?

Two sentences, both load-bearing. The default behavior and its consequence are front-loaded, and the inline caveat follows immediately with the reason attached. No filler or restatement of the title.

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?

There is no output schema, but the description supplies what the tool returns (file path plus per-page character counts) and how to get the content itself. For a 4-parameter extraction tool, the only meaningful omission is guidance on detection of textless PDFs and redirection to OCR.

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 75%, so the schema already documents out, pages, and inline. The description still adds meaning the schema does not: inline has a log-exposure cost, and per-page character counts are what you get instead of the text. It never touches the path or pages parameters, but those are adequately covered by the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource -- 'Extract the text layer to a .txt file' -- plus the return shape (per-page character counts). The phrase 'text layer' implicitly separates it from pdf_ocr, but it never names a sibling explicitly, so the differentiation is inferred rather than stated.

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

Usage Guidelines3/5

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

Gives clear conditional guidance for the inline parameter ('set inline=true only if the caller really needs the content'), which is genuine when-to-use advice. It offers no guidance on when to pick this tool over pdf_ocr or pdf_inspect, nor what happens with scanned PDFs that have no text layer, leaving the main routing decision to inference.

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