Skip to main content
Glama

convert_to_html

Idempotent

Transform Markdown into complete HTML documents with embedded stylesheets and KaTeX math rendering. Converts GitHub-Flavored Markdown including tables and task lists to standalone files or direct HTML strings.

Instructions

Convert Markdown to a complete, styled HTML document. Renders GFM (tables, task lists, strikethrough) and KaTeX math into semantic HTML with an embedded stylesheet for clean presentation. The output is a full document with (charset, KaTeX CSS CDN link, inline styles) and . Side effects: when output_path is provided, writes the HTML file to disk (creates parent directories, overwrites existing files). When output_path is omitted, returns the full HTML string directly. Returns: HTML document string (if no output_path), or JSON { success, file_path, file_size_bytes, format } (if output_path set). Use this when you need a file saved to disk or when you need the full document. Prefer generate_html if you only need the HTML string returned directly (no file I/O) and want inline styles without a CDN link. Prefer convert_to_pdf for print-ready output, or convert_to_image for a visual snapshot.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
markdownYesThe raw Markdown source text to convert. Supports GitHub-Flavored Markdown (tables, task lists, strikethrough) and KaTeX math expressions. Pass the full document content as a string, not a file path.
output_pathNoOptional. Absolute or relative file path (e.g. './output.txt') where the result will be saved. Parent directories are created automatically. If omitted, the converted text content is returned directly in the response as a string. If provided, the file is written to disk and a JSON summary with { success, file_path, file_size_bytes, format } is returned instead.
Behavior4/5

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

Annotations indicate non-readOnly and idempotent behavior; the description adds critical side effect disclosure (file writes to disk, directory creation, overwriting behavior) and documents the dual return format (string vs JSON object) depending on output_path. Does not mention auth needs or rate limits, but covers the primary behavioral traits.

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?

Every sentence earns its place: opens with core function, details features, explains document structure, discloses side effects, specifies return values, and closes with usage guidance. No redundancy despite covering multiple output modes and sibling comparisons.

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?

Despite no output schema, the description fully specifies return behaviors (HTML string vs JSON structure), explains the complete document structure produced (<!DOCTYPE html> with CDN links), and contrasts with relevant siblings. Complete for a dual-mode conversion tool.

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?

With 100% schema coverage, baseline is 3. The description adds semantic value by explaining the implications of providing vs omitting output_path (side effects vs direct return) and elaborating on markdown capabilities (GFM tables, task lists, strikethrough) beyond the schema's basic description.

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 the tool converts Markdown to a complete, styled HTML document, specifying support for GFM and KaTeX. It distinguishes from sibling `generate_html` by emphasizing this produces a full document with file I/O capabilities, while implying `generate_html` is for string-only output.

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?

Excellent guidance: explicitly states 'Use this when you need a file saved to disk' and provides named alternatives with conditions ('Prefer generate_html if you only need the HTML string...', 'Prefer convert_to_pdf for print-ready output'). This creates a clear decision tree against siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/XJTLUmedia/MCP_Markdown_Formatter'

If you have feedback or need assistance with the MCP directory API, please join our Discord server