Skip to main content
Glama

Convert a document file

convert_file
Read-onlyIdempotent

Convert a document file to Markdown or another format. Use this for files: PDF, Word (.docx, .doc), PowerPoint (.pptx, .ppt), Excel (.xlsx, .xls), Jupyter notebooks (.ipynb) and SRT/VTT subtitles; text files (.json, .yaml, .csv, .tsv, .html, .md, .txt) work too. For content you already have as a string, use convert instead - it needs no base64 encoding; for a file at a public URL, use convert_url.

Parameters:

  • file_base64 (required): the whole file, standard base64 with padding (not URL-safe base64, not a path or URL). Invalid base64 returns an error.

  • filename (required): only its extension is used, case-insensitively, and it decides the source format - there is no separate source_format parameter. A wrong extension (e.g. report.pdf for a Word file) makes the conversion fail. Any other or missing extension, including .json, .yaml, .csv, .html, .md and .txt, falls back to detecting the format from the content, exactly like convert with source_format auto (unrecognised content becomes text).

  • target_format (default markdown): allowed values depend on the source format from filename: PDF and Word -> markdown, html, text; PowerPoint, notebooks and subtitles -> markdown only; Excel -> csv, json, yaml, markdown, html, text, docx (every sheet is included; in csv with several sheets, each one starts with a '# === Werkblad: ===' line); text files follow the convert tool's rules. An unsupported pair returns an error that names both formats; EPUB files are always refused (usually copyrighted e-books).

  • pretty_json (default false): only relevant for target_format json, and currently has no effect - JSON output is always indented with two spaces. Ignored for other targets.

Returns the converted content as text. excel and docx output is a binary file, returned as an embedded resource (base64 blob with its MIME type) instead of text.

Read-only: the file is processed in memory and not stored. Requires a slim-down API key or OAuth token; rate-limited per account (default 60 calls per minute).

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_base64": "<file_base64>",
      "filename": "<filename>"
    },
    "name": "convert_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
filenameYesOriginal file name including extension, e.g. report.pdf. The extension (case-insensitive) determines the source format, so it must match the actual content; an unrecognised or missing extension falls back to detecting the format from the content.
file_base64YesThe complete file content, standard base64-encoded (RFC 4648, with padding). Not a path or URL.
pretty_jsonNoOnly meaningful when target_format is json. JSON output is always indented with two spaces, so true and false (default) currently give the same result; it is accepted for compatibility with the REST API. Ignored for every other target.
target_formatNoFormat to convert to. Default markdown. Allowed values depend on the source format derived from filename; the per-type list is in the tool description. excel and docx come back as an embedded binary resource, all others as text.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / filename / description
      Previous value: -"Original file name including extension, e.g. report.pdf. The extension determines the source format, so it must match the actual content."New value: +"Original file name including extension, e.g. report.pdf. The extension (case-insensitive) determines the source format, so it must match the actual content; an unrecognised or missing extension falls back to detecting the format from the content."
    • changedInput schema / properties / pretty_json / description
      Previous value: -"Only applies when target_format is json: true indents the output for readability, false (default) returns compact JSON."New value: +"Only meaningful when target_format is json. JSON output is always indented with two spaces, so true and false (default) currently give the same result; it is accepted for compatibility with the REST API. Ignored for every other target."
    • changedInput schema / properties / target_format / description
      Previous value: -"Format to convert to. Default markdown. Allowed targets depend on the file type (see the tool description)."New value: +"Format to convert to. Default markdown. Allowed values depend on the source format derived from filename; the per-type list is in the tool description. excel and docx come back as an embedded binary resource, all others as text."
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnly, idempotent, non-destructive), which already cover the safety profile. It adds in-memory processing with no storage, the auth requirement (slim-down API key or OAuth token), a rate limit of 60 calls/minute, and concrete failure modes: invalid base64 errors, a mismatched extension fails, an unsupported pair errors naming both formats, EPUB is refused.

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?

Purpose and sibling routing are front-loaded, then parameters, then return/auth notes, which matches how an agent reads it. It is long but mostly earns its length given the format matrix; the main waste is duplicating schema wording for file_base64 and pretty_json.

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?

There is no output schema, so the description carries the return contract itself, and it does: text by default, but excel and docx come back as an embedded base64 resource with a MIME type. Combined with auth, rate limits and error behavior, nothing an agent needs to call this correctly is missing.

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 per-parameter descriptions already explain base64 padding, extension-driven format detection and the no-op pretty_json; the description partly restates those. It still adds real meaning the schema omits: the source→target compatibility matrix, the multi-sheet csv header convention, the content-detection fallback for unrecognised extensions, and the fact that no separate source_format parameter exists.

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?

Opens with a specific verb and resource ('Convert a document file to Markdown or another format') and immediately enumerates the supported source families: PDF, Word, PowerPoint, Excel, notebooks, subtitles and plain text. It is clearly distinguishable from the two siblings by naming both and stating the input shape each expects.

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?

Explicitly routes the agent: use this for files, use convert for in-memory strings, use convert_url for public URLs. It also states when-not conditions per format, e.g. the allowed target_format pairs per source and that EPUB files are always refused, so an agent can decide before calling.

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