Skip to main content
Glama

Extract Text

extract_text
Read-onlyIdempotent

Extract plain text from a PDF or image (base64-encoded). Use when you need raw text for downstream AI analysis (summarization, claim checking, structured extraction). For documents at a public URL, use extract_url instead (no base64 encoding needed). Returns: { pages: number, text: string } Example prompts:

  • "Extract the text from this scanned contract so I can search it."

  • "Give me the raw text from this PDF document."

  • "OCR this image and return the text content."

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mime_typeYesMIME type of the document. Example: "application/pdf" for PDFs, "image/png" for PNG screenshots.
document_base64YesBase64-encoded PDF or image bytes (max ~15 MB). Example: "JVBERi0xLjcNJeLjz9MNCj..." (truncated PDF base64)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
pagesYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "pages": {
      +      "type": "number"
      +    },
      +    "text": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "pages",
      +    "text"
      +  ],
      +  "type": "object"
      +}
  4. Changed2 schema fields changed
    • changedInput schema / properties / document_base64 / description
      Previous value: -"Base64-encoded PDF or image bytes (max ~15 MB)"New value: +"Base64-encoded PDF or image bytes (max ~15 MB). Example: \"JVBERi0xLjcNJeLjz9MNCj...\" (truncated PDF base64)"
    • changedInput schema / properties / mime_type / description
      Previous value: -"MIME type: application/pdf | image/jpeg | image/png | image/webp"New value: +"MIME type of the document. Example: \"application/pdf\" for PDFs, \"image/png\" for PNG screenshots."
  5. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations cover the safety profile (readOnlyHint, idempotentHint), and the description adds the accepted input forms and the base64-vs-URL tradeoff. The 'Returns: { pages, text }' line duplicates the existing output schema rather than adding behavior, and it omits limits like the ~15 MB cap (present only in the schema).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action and routing rule, and the three example prompts are genuinely useful for matching user phrasings. Minor waste in the 'Returns' line, which restates the output 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?

With an output schema present and 100% schema coverage, the description only needs to carry intent and routing — both are fully covered, plus it names extract_structured/check_claims-adjacent downstream uses. Nothing needed to invoke correctly is missing.

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 both parameters are already documented (including the size cap and MIME examples). The description adds no syntax or format detail beyond restating that input is base64-encoded PDF or image, so the baseline 3 applies.

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 or image') and immediately scopes it with the input form (base64-encoded), clearly distinguishing it from the sibling extract_url. An agent can select this tool 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 Guidelines5/5

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

Gives explicit when-to-use ('raw text for downstream AI analysis — summarization, claim checking, structured extraction') and an explicit alternative with the selecting condition ('For documents at a public URL, use extract_url instead'). This is a textbook routing statement.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources