Skip to main content
Glama

Convert a document to Markdown (MarkItDown)

job_doc_to_markdown

Converts one document (PDF with a text layer, DOCX, PPTX, XLSX, XLS, HTML, CSV, JSON, XML, EPUB, TXT; sent as base64) to Markdown with Microsoft MarkItDown, keeping headings, lists and tables. Use it to feed a document's content to a model or search index as clean Markdown. Use job_ocr_tesseract instead for scanned PDFs or images without a text layer (they come back empty here, not charged). Use job_site_render instead for a live web page that needs JavaScript. Cost: at most $0.00006268 per call (measured CPU time), debited from your balance; an empty result or failed run is free. Auth: Authorization: Bearer (POST https://api.gaents.com/v1/accounts, $0.10 free credit); with no key the call returns a signed 402 quote payable in BSV or USDC via x402. Errors (isError, error.code): 400 missing_param/bad_param, 401 bad_api_key, 402 low balance, 429 busy (retry in seconds), 503 job_unavailable, 502 job_failed (refunded).

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": {
      "file_b64": "<file_b64>",
      "filename": "<filename>"
    },
    "name": "job_doc_to_markdown"
  }
}

Input Schema

NameRequiredDescriptionDefault
file_b64YesThe document file's bytes, base64-encoded, no data: prefix. (at most 3000000 bytes decoded)
filenameYesThe document's file name; its extension (pdf, docx, pptx, xlsx, xls, html, htm, csv, json, xml, epub, txt, md) picks the converter.

Output Schema

NameRequiredDescriptionDefault
emptyYestrue = nothing found, not charged
outputYes{markdown, chars, truncated, title}
sourceNo
chargedNo
measuredNowall seconds of this run
charged_usdYes
receipt_quote_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "charged": {
      +      "type": "boolean"
      +    },
      +    "charged_usd": {
      +      "type": "number"
      +    },
      +    "empty": {
      +      "description": "true = nothing found, not charged",
      +      "type": "boolean"
      +    },
      +    "measured": {
      +      "description": "wall seconds of this run",
      +      "type": "object"
      +    },
      +    "output": {
      +      "description": "{markdown, chars, truncated, title}",
      +      "properties": {
      +        "chars": {},
      +        "markdown": {},
      +        "title": {},
      +        "truncated": {}
      +      },
      +      "type": "object"
      +    },
      +    "receipt_quote_id": {
      +      "type": "string"
      +    },
      +    "source": {
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "output",
      +    "empty",
      +    "charged_usd",
      +    "receipt_quote_id"
      +  ],
      +  "type": "object"
      +}
  2. Changed9 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / file_b64 / contentEncoding
      Added value: +"base64"
    • changedInput schema / properties / file_b64 / description
      Previous value: -"the document, base64"New value: +"The document file's bytes, base64-encoded, no data: prefix. (at most 3000000 bytes decoded)"
    • addedInput schema / properties / file_b64 / examples
      Added value: +[
      +  "PGgxPkV4YW1wbGU8L2gxPjxwPkhlbGxvIGZyb20gZ2FlbnRzLjwvcD4="
      +]
    • changedInput schema / properties / filename / description
      Previous value: -"its file name; the extension picks the converter"New value: +"The document's file name; its extension (pdf, docx, pptx, xlsx, xls, html, htm, csv, json, xml, epub, txt, md) picks the converter."
    • addedInput schema / properties / filename / examples
      Added value: +[
      +  "example.html"
      +]
    • addedInput schema / properties / filename / maxLength
      Added value: +120
    • addedInput schema / properties / filename / minLength
      Added value: +1
    • addedInput schema / properties / filename / pattern
      Added value: +"^(?:[A-Za-z0-9 ._()-]{1,100}\\.(pdf|docx|pptx|xlsx|xls|html|htm|csv|json|xml|epub|txt|md))$"
  3. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare the generic hints (readOnlyHint=false, destructiveHint=false, idempotentHint=false), and the description adds substantial context beyond them: cost ceiling per call and its CPU-time basis, that empty/failed runs are free, the Bearer auth requirement with a signed 402 x402 fallback, and a full error-code table with retry semantics and refunds. That is exactly the behavioral disclosure 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?

The content is front-loaded correctly: what it does, then when to use it, then alternatives, then operational details. It is dense and the auth/cost/error tail is long, but nearly every clause is decision-relevant; only the repeated format enumeration overlaps with the 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?

For a two-parameter conversion job with an output schema already present, the description covers everything an agent needs: input constraints, alternative routing, cost, auth, and the full error surface with which codes are refundable. Nothing required to call it 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 base64 encoding, size limit, and the extension-driven converter selection. The description only restates 'sent as base64' and repeats the format list, adding no meaning the schema does not already carry, 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?

The description opens with a specific verb and resource ('Converts one document ... to Markdown with Microsoft MarkItDown') and enumerates the accepted input formats, so the agent knows exactly what transformation happens. It also names two sibling tools it is not, making it distinguishable without opening any 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?

It states the intended use case ('feed a document's content to a model or search index as clean Markdown') and gives explicit exclusions with named alternatives: job_ocr_tesseract for scanned PDFs/images without a text layer, job_site_render for JavaScript-rendered web pages. The failure mode that selects the alternative ('they come back empty here, not charged') is spelled out.

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