Skip to main content
Glama

Extract fields from an attached document

dokyumi_extract_document

Extract an authorized attached PDF or image using a saved Dokyumi schema. Prefer the host-provided file download_url/file_id. If unavailable, file_inline accepts canonical base64 computed from exact user-uploaded bytes with original file_name and matching supported mime_type, at most 32 KiB. Supply exactly one of file or file_inline; never reconstruct a document from text. This stores the document/result. For subscription workspaces, obtain user agreement to use existing credits before setting use_existing_credits=true (one credit per up-to-five pages). BYOK lifetime workspaces have no monthly extraction cap: first run preflight, obtain agreement to separate OpenRouter charges, and set confirm_provider_charges=true. BYOK supports PDF, JPEG, PNG and WebP within the workspace storage limit, with 30-day retention. Reuse the same request_key for a retry; never automatically start a new extraction after a timeout. Review confidence and validation errors before using fields.

Input Schema

NameRequiredDescriptionDefault
fileNo
file_inlineNo
request_keyYes
schema_slugYes
use_existing_creditsNo
confirm_provider_chargesNo

Output Schema

NameRequiredDescriptionDefault
dataYes
statusYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / confirm_provider_charges
      Added value: +{
      +  "const": true,
      +  "type": "boolean"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "schema_slug",
      -  "request_key",
      -  "use_existing_credits"
      -]New value: +[
      +  "schema_slug",
      +  "request_key"
      +]
  2. Changed3 schema fields changed
    • addedInput schema / oneOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "file_inline"
      +      ]
      +    },
      +    "required": [
      +      "file"
      +    ]
      +  },
      +  {
      +    "not": {
      +      "required": [
      +        "file"
      +      ]
      +    },
      +    "required": [
      +      "file_inline"
      +    ]
      +  }
      +]
    • addedInput schema / properties / file_inline
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "data_base64": {
      +      "maxLength": 43692,
      +      "minLength": 4,
      +      "type": "string"
      +    },
      +    "file_name": {
      +      "maxLength": 200,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "mime_type": {
      +      "enum": [
      +        "application/pdf",
      +        "image/jpeg",
      +        "image/png",
      +        "image/tiff",
      +        "image/webp"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "data_base64",
      +    "file_name",
      +    "mime_type"
      +  ],
      +  "type": "object"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "file",
      -  "schema_slug",
      -  "request_key",
      -  "use_existing_credits"
      -]New value: +[
      +  "schema_slug",
      +  "request_key",
      +  "use_existing_credits"
      +]
  3. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations establish write/non-idempotent/openWorld, and the description adds meaningful side-effect detail beyond them: it stores the document and result, bills one credit per five pages for subscription workspaces, applies a 30-day retention window and workspace storage limit, and warns against auto-retrying after a timeout. This is exactly the supplementary 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.

Conciseness4/5

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

Front-loaded with purpose and the file-source preference, then credits/BYOK, then retry policy, so scanning order matches decision order. It is dense and mixes several concerns in single sentences, but almost every clause carries operational weight.

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 six-parameter write tool with nested objects and an output schema, it covers input sourcing, size and format limits, billing gates, retention, and retry semantics, and correctly closes with a pointer to review confidence and validation errors rather than restating return fields.

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 description coverage is 0%, so the description carries the load and does well: it explains file vs file_inline exclusivity, canonical base64 from exact user bytes with original file_name and matching mime_type, the 32 KiB cap, and the agreement preconditions for use_existing_credits and confirm_provider_charges. schema_slug is left unelaborated, and the supported-format list (PDF/JPEG/PNG/WebP) omits the image/tiff value present in the schema enum.

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?

The first sentence gives a specific verb and resource ('Extract an authorized attached PDF or image using a saved Dokyumi schema'), which distinguishes it from retrieval siblings like dokyumi_get_extraction. It never explicitly contrasts with those siblings, but the action and input domain are unambiguous.

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?

Explicit routing rules: prefer host-provided download_url/file_id, fall back to file_inline only when unavailable, supply exactly one of the two, run preflight before a BYOK run, and reuse request_key on retry instead of starting a new extraction. Prerequisites for credits and provider charges are spelled out with the required user agreement step.

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