Skip to main content
Glama

Parse document

parse_document

Extract structured fields from a PDF, PNG, JPEG, or text file sent as base64 in file_base64, or from plain text sent in text (10 MB and 10 pages on Free, 25 MB on paid; pages per document by plan: Starter 50, Pro 200, Business 500). 1 credit per page; an image is 1 page; text is 1 credit per 3,000 characters. Nothing is stored. Send exactly one of file_base64 or text. The result has status and values. Set citations to true to also get, for each value, the page, the printed text, and a box where it was read.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "parse_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
textNoThe document as plain text, for example a pasted invoice or email. 1 credit per 3,000 characters (started), at least 1. At most 30,000 characters on Free and 150,000 on paid plans. The text is not stored. Send this or file_base64, not both.
schemaNoThe slug of a layout saved in this workspace, or a literal layout object (sent in the `schema` JSON field). A layout is {"type":"object","properties":{...}}. Each property is {"type":T} where T is one of any, null, boolean, string, number, date, array, object. An optional description, at most 400 characters, tells the model how to read that key. An optional required array lists the keys that must be present. A date is a string yyyy-mm-dd. An array adds "items" (one node). An object adds "properties" and may add "required". At most 4 levels below the root, 100 keys, and 16384 bytes.
strictNoA long document is read in chunks of pages. By default a chunk that cannot be read leaves a partial result: status "partial", the pages that failed in failed_page_ranges, and credits only for the pages that were read. When true, any chunk that cannot be read fails the whole parse with CHUNK_FAILED (502) and no credits are used. Default false.
citationsNoWhen true, the result also has citations: for each value's path, the page, the printed text it was read from, a box [x0, y0, x1, y1] on the page (0 to 1 from the top left), and a status saying whether the text was found in the document. Same credits. Default false.
file_base64NoBase64-encoded PDF, PNG, JPEG, or UTF-8 text file (.txt, .md, .csv, .eml). At most 10 MB and 10 pages on Free, 25 MB on paid plans; pages per document are set by plan (Starter 50, Pro 200, Business 500). Each page costs 1 credit; an image is 1 page; text is 1 credit per 3,000 characters. The bytes are not stored. Send this or text, not both.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / file_base64 / description
      Previous value: -"Base64-encoded PDF, PNG, JPEG, or UTF-8 text file (.txt, .md, .csv, .eml). At most 10 MB and 10 pages on Free, 25 MB and 50 pages on paid plans. Each page costs 1 credit; an image is 1 page; text is 1 credit per 3,000 characters. The bytes are not stored. Send this or text, not both."New value: +"Base64-encoded PDF, PNG, JPEG, or UTF-8 text file (.txt, .md, .csv, .eml). At most 10 MB and 10 pages on Free, 25 MB on paid plans; pages per document are set by plan (Starter 50, Pro 200, Business 500). Each page costs 1 credit; an image is 1 page; text is 1 credit per 3,000 characters. The bytes are not stored. Send this or text, not both."
    • addedInput schema / properties / strict
      Added value: +{
      +  "description": "A long document is read in chunks of pages. By default a chunk that cannot be read leaves a partial result: status \"partial\", the pages that failed in failed_page_ranges, and credits only for the pages that were read. When true, any chunk that cannot be read fails the whole parse with CHUNK_FAILED (502) and no credits are used. Default false.",
      +  "type": "boolean"
      +}
  2. Changed2 schema fields changed
    • changedInput schema / properties / schema / description
      Previous value: -"The name of a schema saved in this workspace, or a literal schema object. A schema is {\"type\":\"object\",\"properties\":{...}}. Each property is {\"type\":T} where T is one of any, null, boolean, string, number, date, array, object. An optional description, at most 400 characters, tells the model how to read that field. An optional required array lists the keys that must be present. A date is a string yyyy-mm-dd. An array adds \"items\" (one node). An object adds \"properties\" and may add \"required\". At most 4 levels below the root, 100 keys, and 16384 bytes."New value: +"The slug of a layout saved in this workspace, or a literal layout object (sent in the `schema` JSON field). A layout is {\"type\":\"object\",\"properties\":{...}}. Each property is {\"type\":T} where T is one of any, null, boolean, string, number, date, array, object. An optional description, at most 400 characters, tells the model how to read that key. An optional required array lists the keys that must be present. A date is a string yyyy-mm-dd. An array adds \"items\" (one node). An object adds \"properties\" and may add \"required\". At most 4 levels below the root, 100 keys, and 16384 bytes."
    • changedInput schema / properties / schema / oneOf
      Previous value: -[
      -  {
      -    "description": "Lowercase letters, digits, underscores, and hyphens. No spaces.",
      -    "maxLength": 80,
      -    "minLength": 1,
      -    "pattern": "^[a-z0-9_-]+$",
      -    "type": "string"
      -  },
      -  {
      -    "description": "A schema is {\"type\":\"object\",\"properties\":{...}}. Each property is {\"type\":T} where T is one of any, null, boolean, string, number, date, array, object. An optional description, at most 400 characters, tells the model how to read that field. An optional required array lists the keys that must be present. A date is a string yyyy-mm-dd. An array adds \"items\" (one node). An object adds \"properties\" and may add \"required\". At most 4 levels below the root, 100 keys, and 16384 bytes.",
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "description": "Stable id: lowercase letters, digits, underscores (hyphens accepted, stored as underscores).",
      +    "maxLength": 80,
      +    "minLength": 1,
      +    "pattern": "^[a-z0-9_-]+$",
      +    "type": "string"
      +  },
      +  {
      +    "description": "A layout is {\"type\":\"object\",\"properties\":{...}}. Each property is {\"type\":T} where T is one of any, null, boolean, string, number, date, array, object. An optional description, at most 400 characters, tells the model how to read that key. An optional required array lists the keys that must be present. A date is a string yyyy-mm-dd. An array adds \"items\" (one node). An object adds \"properties\" and may add \"required\". At most 4 levels below the root, 100 keys, and 16384 bytes.",
      +    "type": "object"
      +  }
      +]
  3. Changed1 schema field changed
    • addedInput schema / properties / citations
      Added value: +{
      +  "description": "When true, the result also has citations: for each value's path, the page, the printed text it was read from, a box [x0, y0, x1, y1] on the page (0 to 1 from the top left), and a status saying whether the text was found in the document. Same credits. Default false.",
      +  "type": "boolean"
      +}
  4. Changed2 schema fields changed
    • changedInput schema / properties / file_base64 / description
      Previous value: -"Base64-encoded PDF, PNG, or JPEG. At most 10 MB and 10 pages on Free, 25 MB and 50 pages on paid plans. Each page costs 1 credit; an image is 1 page. The bytes are not stored."New value: +"Base64-encoded PDF, PNG, JPEG, or UTF-8 text file (.txt, .md, .csv, .eml). At most 10 MB and 10 pages on Free, 25 MB and 50 pages on paid plans. Each page costs 1 credit; an image is 1 page; text is 1 credit per 3,000 characters. The bytes are not stored. Send this or text, not both."
    • addedInput schema / properties / text
      Added value: +{
      +  "description": "The document as plain text, for example a pasted invoice or email. 1 credit per 3,000 characters (started), at least 1. At most 30,000 characters on Free and 150,000 on paid plans. The text is not stored. Send this or file_base64, not both.",
      +  "type": "string"
      +}
  5. Changed2 schema fields changed
    • removedInput schema / properties / document
      Removed value: -{
      -  "description": "Base64-encoded PDF, PNG, or JPEG. At most 10 MB and 10 pages on Free, 25 MB and 50 pages on paid plans. Each page costs 1 credit; an image is 1 page. The bytes are not stored.",
      -  "type": "string"
      -}
    • addedInput schema / properties / file_base64
      Added value: +{
      +  "description": "Base64-encoded PDF, PNG, or JPEG. At most 10 MB and 10 pages on Free, 25 MB and 50 pages on paid plans. Each page costs 1 credit; an image is 1 page. The bytes are not stored.",
      +  "type": "string"
      +}
  6. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint=false, destructiveHint=false, idempotentHint=false), it discloses the properties an agent actually needs: nothing is stored, credits are charged per page or per 3,000 characters, and plan-dependent size/page ceilings. It also explains the partial-result path (status 'partial', failed_page_ranges) versus strict=true which yields CHUNK_FAILED (502) with no credits — genuine behavioral detail that the annotations do not carry.

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?

The purpose and one-of constraint are front-loaded in the first two sentences, and every sentence carries operational content. It is dense, with plan/credit parentheticals that partly duplicate the schema, but nothing is truly superfluous.

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?

For a 5-parameter tool with no output schema, the description covers input format, one-of exclusivity, cost model, failure semantics, and a summary of the return shape. An agent can call it and interpret the response without consulting anything else.

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 100%, so the parameters are already documented; the description largely restates them (size limits, credits, one-of rule). What it adds beyond the schema is the result contract — 'The result has status and values' and what citations returns per value — which is not derivable from the input schema and there is no output schema.

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?

The opening clause names a specific verb+resource ('Extract structured fields') and enumerates the accepted input formats (PDF, PNG, JPEG, text via file_base64 or text). It is instantly distinguishable from the schema-management siblings (create_schema, list_schemas, etc.), which operate on layouts rather than documents.

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 gives a hard input rule ('Send exactly one of file_base64 or text') and opt-in framing for citations, so an agent knows how to invoke it correctly. It does not state when to choose this over another extraction path or name any exclusions, so context is clear but not a full when/when-not guide.

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