Skip to main content
Glama

Parse a document into structured JSON

parse_document

Extract clean, schema-guaranteed JSON from a PDF or image. Provide the document via url or base64. Pass an optional JSON schema to constrain the output shape, and instructions to guide extraction. Returns the extracted data plus a confidence score and a review_needed flag. Costs 1 credit per successful call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoPublic http(s) URL of the PDF or image to parse.
base64NoBase64-encoded document bytes (alternative to `url`). Provide `media_type` alongside it.
redactNoWhen true, PII (emails, SSNs, card numbers, phones, etc.) is masked in the output before it leaves the server.
schemaNoOptional JSON Schema describing the exact output shape you want. When provided, the returned `data` conforms to it.
schema_idNoOptional named template to use instead of a hand-written schema, e.g. "invoice", "receipt", "resume". Call the list_schemas tool for the full set. Ignored when `schema` is provided.
media_typeNoMIME type for `base64` input, e.g. application/pdf, image/png, image/jpeg.
instructionsNoOptional natural-language guidance for what to extract.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Beyond annotations, it discloses 'Costs 1 credit per successful call', which explains the non-read-only billing side effect implied by readOnlyHint=false. It also reveals return fields (confidence score, review_needed flag) and schema-guaranteed output, which are absent from an output schema.

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 compact sentences front-load the core extraction behavior, then cover input mechanism, optional controls, return values, and cost. No filler or redundancy.

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?

With no output schema, it correctly names return values, and all 7 parameters are covered by the schema. Missing operational details like conflict between url/base64 or file-size limits are minor and don't prevent correct invocation.

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%, and parameter docs already describe url, base64, media_type, schema, schema_id, redact, and instructions. The description only summarizes url/base64/schema/instructions without adding new semantics, so baseline 3 is appropriate.

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?

Description uses specific verb 'Extract' with clear resource 'PDF or image' and outcome 'clean, schema-guaranteed JSON', which differentiates from sibling parse_text. It tells agent exactly what tool does.

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?

It clearly scopes usage to PDF/image inputs and states input methods (url or base64) and optional schema/instructions. It doesn't explicitly say when to choose parse_text or when not to use this tool, but the context is clear.

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.