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.

TDQS

A5/5.0
Behavior5/5

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

Annotations provide minimal behavioral info (readOnlyHint=false, destructiveHint=false). The description adds critical behavioral traits: output format specifics, filename derivation behavior, error recovery strategy, newline sensitivity, and response fields. No contradictions 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 well-structured with numbered sections, clear headings, and concise guidance. Every sentence adds value—there is no redundancy or fluff. It is appropriately detailed for the tool's complexity without being verbose.

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?

Given 8 parameters, 3 enums, no output schema, and the complexity of the tool, the description covers all necessary aspects: output format options, filename handling, error recovery, page size and orientation defaults, newline requirements, and response field disclosure. It is comprehensive and leaves no critical gap.

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?

The input schema has 100% description coverage, but the description significantly enhances understanding: for 'content' it emphasizes the need for real newlines and provides a concrete example; for 'fileName' it explains how to derive it from attached files; for 'templateName' it instructs to call list_all_templates first. This goes well beyond the 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 clearly states 'Convert markdown to a professionally formatted document using an MDMagic template.' It includes a specific verb (convert), resource (markdown), and context (MDMagic template), effectively distinguishing from sibling tools like validate_markdown or list_all_templates.

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?

The description provides explicit guidance on when to ask the user for output format (if ambiguous), how to handle 'template not found' errors (call list_all_templates), and when to provide fileName. It also advises against falling back to code execution, offering clear alternatives.

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.6/5.0
Disambiguation5/5

Each tool targets a distinct function: credit management, conversion, estimation, template listing/details/recommendation, validation, and settings. Even the three list tools are clearly differentiated by scope (all, built-in, custom). No ambiguity.

Naming Consistency5/5

All tools follow a consistent verb_noun snake_case pattern (e.g., check_credit_balance, list_all_templates, validate_markdown). No mixing of styles or vague verbs.

Tool Count5/5

With 10 tools, the surface is well-scoped for a document conversion server. Each tool addresses a necessary step in the conversion workflow without being overengineered or sparse.

Completeness5/5

The tool set covers the full lifecycle: credit checks, cost estimation, markdown validation, template discovery (all/built-in/custom), details, recommendations, conversion, and default settings. No obvious gaps for the intended use case.

Resources