Skip to main content
Glama

Convert text or data

convert
Read-onlyIdempotent

Convert text or structured data that you already have as a string - JSON, YAML, CSV, HTML, Markdown or plain text - into Markdown or another format. Use this for inline content; for a file (PDF, Word, PowerPoint, Excel, Jupyter notebook, SRT/VTT subtitles) use convert_file, and for a web address use convert_url instead.

Parameters:

  • input (required): the content as a plain string, not base64. Empty or whitespace-only input returns an empty result.

  • source_format (default auto): with auto the format is detected in this order: SRT/VTT subtitles, JSON (a Jupyter notebook if it has cells and nbformat), HTML, CSV/TSV (at least two rows with the same number of columns, two or more), YAML, Markdown, and otherwise text. Because text only converts to markdown or html, an undetected table or data document fails for other targets - set source_format explicitly in that case.

  • target_format (default markdown): must differ from the source, including the detected one - Markdown input with the default target fails, so pick e.g. html or text. Allowed targets per source: json -> yaml, csv, markdown, html, text, excel, docx; yaml -> json, csv, markdown, html, text, excel, docx; csv -> json, yaml, markdown, html, text, excel, docx; markdown -> json, yaml, csv, html, text, excel, docx; html -> markdown, text; text -> markdown, html; detected notebooks and subtitles -> markdown. Converting Markdown to json, yaml, csv or excel uses its first table, else key: value lines or lists. An unsupported pair returns an error that names both formats.

  • 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: nothing is stored, and the same input always gives the same output. 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": {
      "input": "<input>"
    },
    "name": "convert"
  }
}

Input Schema

NameRequiredDescriptionDefault
inputYesThe content to convert, as a string (e.g. a JSON document, a CSV table or an HTML page). Empty input returns an empty result.
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.
source_formatNoFormat of input. Default auto: detected from the content, falling back to text when nothing matches (see the tool description for the detection order). Set it explicitly when detection could guess wrong, e.g. a one-line CSV, YAML-like prose, or Markdown without headings or lists.
target_formatNoFormat to convert to. Default markdown. Must differ from the (detected) source format and be allowed for it; the per-source 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 / 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 / source_format / description
      Previous value: -"Format of input. Default auto: detected from the content. Set it when detection could guess wrong, e.g. a one-line CSV or Markdown that looks like plain text."New value: +"Format of input. Default auto: detected from the content, falling back to text when nothing matches (see the tool description for the detection order). Set it explicitly when detection could guess wrong, e.g. a one-line CSV, YAML-like prose, or Markdown without headings or lists."
    • changedInput schema / properties / target_format / description
      Previous value: -"Format to convert to. Default markdown. Must differ from the source format, and must be a logical target for it (see the tool description)."New value: +"Format to convert to. Default markdown. Must differ from the (detected) source format and be allowed for it; the per-source 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?

Annotations already declare read-only/idempotent/non-destructive, but the description adds substantial context beyond them: empty input returns an empty result, unsupported source/target pairs return an error naming both formats, excel/docx come back as an embedded base64 resource rather than text, API-key/OAuth requirement, and a 60-calls-per-minute rate limit. It also discloses a behavioral quirk (pretty_json currently has no effect) that annotations could never convey.

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 the purpose and sibling routing in the first two sentences, then a clean per-parameter structure. It is long for a four-parameter tool, and the pretty_json explanation plus the target-must-differ rule are stated twice, but nearly every line conveys operationally relevant information.

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?

With no output schema, the description covers the return shape (text, or an embedded binary resource with MIME type for excel/docx) and failure modes (unsupported pair, empty input, markdown-to-markdown default clash). Given four parameters and a conversion matrix, an agent has everything needed to call it correctly on the first attempt.

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 baseline is 3, but the description genuinely carries semantics the schema defers to it: the full detection order for source_format and the per-source matrix of allowed target_format values (plus the requirement that target differ from the detected source). The only redundancy is pretty_json, which is explained near-identically in both places.

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 first sentence states a specific verb (convert) plus the exact resource scope (inline string content: JSON, YAML, CSV, HTML, Markdown, plain text) and the supported outputs. It immediately distinguishes itself from convert_file and convert_url by naming both siblings and the input type each handles.

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 rule: inline content here, files (PDF, Word, PowerPoint, Excel, notebook, subtitles) to convert_file, URLs to convert_url. It also gives conditional guidance inside the parameters, e.g. set source_format explicitly when auto-detection could guess wrong, and pick a non-markdown target when the input is already Markdown.

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