Skip to main content
Glama

markdown-to-html

Convert Markdown content to HTML using this utility. Ideal for developers and system administrators needing quick transformations for web or documentation purposes.

Instructions

Convert Markdown to HTML

Input Schema

NameRequiredDescriptionDefault
markdownYesMarkdown content to convert to HTML

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "markdown": { "description": "Markdown content to convert to HTML", "type": "string" } }, "required": [ "markdown" ], "type": "object" }

Implementation Reference

  • The handler function that performs the core logic of converting Markdown to HTML using the 'marked' library with GFM support and line breaks. Returns formatted HTML or error message.
    }, async ({ markdown }) => { try { const { marked } = await import("marked"); const html = marked(markdown, { breaks: true, gfm: true }); return { content: [ { type: "text", text: `HTML result:\n${html}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error converting Markdown to HTML: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }
  • Zod input schema defining the 'markdown' parameter as a string.
    inputSchema: { markdown: z.string().describe("Markdown content to convert to HTML"), },
  • The registration function that registers the tool named 'convert_markdown_to_html' with the MCP server, including description, input schema, annotations, and handler.
    export function registerConvertMarkdownHtml(server: McpServer) { server.registerTool("convert_markdown_to_html", { description: "Convert Markdown to HTML", inputSchema: { markdown: z.string().describe("Markdown content to convert to HTML"), }, // VS Code compliance annotations annotations: { title: "Convert Markdown To Html", description: "Convert Markdown to HTML", readOnlyHint: false } }, async ({ markdown }) => { try { const { marked } = await import("marked"); const html = marked(markdown, { breaks: true, gfm: true }); return { content: [ { type: "text", text: `HTML result:\n${html}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error converting Markdown to HTML: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } ); }

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/wrenchpilot/it-tools-mcp'

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