Skip to main content
Glama

convert_markdown

Convert markdown content to HTML and plain text for specific platforms like Google Docs, Word, Slack, and email, with appropriate formatting for each destination.

Instructions

Convert markdown to destination-specific HTML and plain text. Returns JSON with 'html' and 'plain_text' fields. For Slack, present the plain_text to the user. For Google Docs/Word/OneNote, direct users to unmarkdown.com to use the copy button (raw HTML cannot be pasted into these apps). Does not render Chart.js, Mermaid, Graphviz, or KaTeX; use publish_document for documents with diagrams or math.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
markdownYesMarkdown content to convert
destinationNoTarget format (default: "generic")
template_idNoVisual template ID (default: "swiss")
theme_modeNoColor theme (default: "light")

Implementation Reference

  • The handler logic for the 'convert_markdown' tool, which sends a POST request to the API.
    async ({ markdown, destination, template_id, theme_mode }) => {
      try {
        const body: Record<string, unknown> = { markdown };
        if (destination) body.destination = destination;
        if (template_id) body.template_id = template_id;
        if (theme_mode) body.theme_mode = theme_mode;
        const result = await client.request("POST", "/v1/convert", body);
        return jsonResult(result);
      } catch (err) {
        return errorResult(err);
      }
    },
  • src/tools.ts:34-60 (registration)
    Registration of the 'convert_markdown' tool with its schema definition.
    server.tool(
      "convert_markdown",
      "Convert markdown to destination-specific HTML and plain text. Returns JSON with 'html' and 'plain_text' fields. For Slack, present the plain_text to the user. For Google Docs/Word/OneNote, direct users to unmarkdown.com to use the copy button (raw HTML cannot be pasted into these apps). Does not render Chart.js, Mermaid, Graphviz, or KaTeX; use publish_document for documents with diagrams or math.",
      {
        markdown: z.string().describe("Markdown content to convert"),
        destination: z
          .enum([
            "google-docs",
            "word",
            "slack",
            "onenote",
            "email",
            "plain-text",
            "generic",
            "html",
          ])
          .optional()
          .describe('Target format (default: "generic")'),
        template_id: z
          .string()
          .optional()
          .describe('Visual template ID (default: "swiss")'),
        theme_mode: z
          .enum(["light", "dark"])
          .optional()
          .describe('Color theme (default: "light")'),
      },

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/UnMarkdown/mcp-server'

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