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
| Name | Required | Description | Default |
|---|---|---|---|
| markdown | Yes | Markdown content to convert | |
| destination | No | Target format (default: "generic") | |
| template_id | No | Visual template ID (default: "swiss") | |
| theme_mode | No | Color theme (default: "light") |
Implementation Reference
- src/tools.ts:68-79 (handler)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")'), },