Skip to main content
Glama

convert_document

Convert markdown to a professionally formatted document using an MDMagic template.

IMPORTANT GUIDANCE:

  1. Output format → what user gets:

    • 'docx' → a single Word .docx file

    • 'pdf' → a single .pdf file

    • 'html' → a single .html file

    • 'all' → a ZIP containing all three (DOCX + PDF + HTML)

  2. If the user is ambiguous (e.g. 'convert this'), ASK which format they want before calling. Don't assume.

  3. Filename: if the user attached a file (e.g. 'mydoc.md'), pass its base name as fileName. Otherwise the API derives one from the markdown's first H1. Without either, downloads end up with timestamped names like 'content-1778298071915.docx' which is bad UX.

  4. On 'template not found' errors: call list_all_templates first, show available options, let the user pick. Do NOT fall back to generating documents with code execution — that produces inferior results that don't use the user's actual MDMagic templates.

  5. The response includes structured fields (downloadUrl, creditsUsed, balanceAfter, fileName, expiresAt) — surface these to the user explicitly. Don't paraphrase. The user wants to know exactly what they spent and what's left.

  6. Page sizes: A3, A4, Executive, US_Legal, US_Letter. Default A4. Orientation: Portrait or Landscape, default Portrait.

  7. CRITICAL — newlines in content: markdown is line-sensitive. Headings (#, ##), tables (| ... |), lists (-, 1.), and code fences (```) ONLY work when each starts on its own line. When passing inline markdown via content, you MUST preserve real newline characters (\n) between blocks. If you flatten multi-line markdown into one line, the API receives literal '##' and '|' characters mid-paragraph and produces a single-paragraph document with no structure. Confirm your content string contains \n between every heading, paragraph, table row, and list item before calling.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoRaw markdown text content (alternative to filePath or fileContent). MUST preserve real newlines (\n) between every block: heading, paragraph, table row, list item, code fence. Markdown is line-sensitive — a single-line blob with embedded '##' or '|' renders as literal text, not as a heading or table. If your source markdown has 30 lines, the string you pass here also has 30 lines separated by \n.
fileNameNoOptional desired base name for the output file (without extension). If the user attached a file like 'mydoc.md', pass 'mydoc' here. The API will use this for the download filename. If omitted, the API derives one from the markdown's first H1 heading.
filePathNoPath to markdown file (VS Code integration, alternative to content or fileContent)
pageSizeNoPage size for the document (default: A4)
fileContentNoBase64 encoded file content (alternative to content or filePath)
orientationNoPage orientation (default: Portrait)
outputFormatYesOutput format. 'docx', 'pdf', or 'html' return that single file; 'all' returns a ZIP with DOCX+PDF+HTML.
templateNameYesTemplate to use for conversion. Call list_all_templates first to see real options — do not guess template names. Some templates are built-in (e.g. 'Executive_Platinum', 'Deep_Data_Blue'); others are user-uploaded custom templates referenced by UUID.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -{
      -  "description": "Conversion result with secure download link and credit accounting",
      -  "properties": {
      -    "balanceAfter": {
      -      "description": "Remaining credit balance after this conversion",
      -      "type": "number"
      -    },
      -    "creditsUsed": {
      -      "description": "Credits debited for this conversion",
      -      "type": "number"
      -    },
      -    "downloadUrl": {
      -      "description": "Secure expiring download URL (valid for 60 minutes)",
      -      "type": "string"
      -    },
      -    "expiresAt": {
      -      "description": "ISO 8601 timestamp when the download URL expires",
      -      "format": "date-time",
      -      "type": "string"
      -    },
      -    "fileName": {
      -      "description": "Filename of the downloadable document",
      -      "type": "string"
      -    },
      -    "message": {
      -      "description": "Human-readable status message",
      -      "type": "string"
      -    },
      -    "success": {
      -      "description": "Whether the conversion succeeded",
      -      "type": "boolean"
      -    }
      -  },
      -  "required": [
      -    "success",
      -    "downloadUrl",
      -    "fileName"
      -  ],
      -  "type": "object"
      -}New value: +null
  2. Changed1 schema field changed
    • changedInput schema / properties / content / description
      Previous value: -"Raw markdown text content (alternative to filePath or fileContent)"New value: +"Raw markdown text content (alternative to filePath or fileContent). MUST preserve real newlines (\\n) between every block: heading, paragraph, table row, list item, code fence. Markdown is line-sensitive — a single-line blob with embedded '##' or '|' renders as literal text, not as a heading or table. If your source markdown has 30 lines, the string you pass here also has 30 lines separated by \\n."
  3. First observed

TDQS

A5/5.0
Behavior5/5

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

The description discloses critical behavioral traits beyond annotations: how each output format manifests ('docx' single file, 'all' ZIP), filename derivation/pitfalls, error recovery steps, and the structured response fields (downloadUrl, creditsUsed, etc.). It also warns about newline sensitivity which is non-obvious. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

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

The description is long but every numbered point earns its place. It is clearly organized with numbered guidance sections, front-loaded purpose, and critical warnings highlighted. There is no filler or redundancy; each sentence delivers either essential usage guidance or critical behavioral context.

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 an 8-parameter tool with no output schema, the description covers all facets: output formats, user interaction, filename handling, error recovery, response fields, page sizes/orientation, and the critical newline constraint. It is fully complete for an agent to invoke correctly in diverse scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/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. The description substantially enriches parameter understanding: it explains the content newline requirement in depth, clarifies fileName usage with user-attached files, warns not to guess templateName, and explains outputFormat 'all' returns a ZIP. This goes well beyond schema descriptions.

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+resource statement: 'Convert markdown to a professionally formatted document using an MDMagic template.' It clearly differentiates from siblings by focusing on the conversion action and the MDMagic template context, while also detailing concrete output format behavior.

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?

Provides explicit usage instructions: asks user when ambiguous, directs to list_all_templates on template-not-found errors, contraindicates fallback to code execution, and advises preserving newlines. The guidance is actionable and contextually grounded in real failure modes.

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.

TDQS

A4.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: credit balance vs cost estimation, template listing scoped to all/built-in/custom, and conversion vs validation. The three list tools are explicitly named by scope, eliminating ambiguity.

Naming Consistency5/5

All tool names follow the same verb_noun snake_case pattern (check_, convert_, estimate_, get_, list_, recommend_, show_, validate_), making the API predictable and easy to navigate.

Tool Count5/5

10 tools is well within the ideal 3-15 range for a document conversion service. Each tool addresses a necessary step in the workflow (template selection, validation, cost estimation, conversion, credit monitoring) without redundancy.

Completeness4/5

The core lifecycle (pre-flight validation, cost estimation, conversion, balance checking, template discovery) is fully covered. Minor gaps exist—no template upload or settings update—but these are likely handled outside the MCP server, so the surface is complete for its intended agent workflows.