it-tools-mcp
Version:
MCP-compliant server access to over 100 IT tools and utilities commonly used by developers, system administrators, and IT professionals.
40 lines (39 loc) • 1.19 kB
JavaScript
import { z } from "zod";
export function registerConvertMarkdownHtml(server) {
server.registerTool("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",
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'}`,
},
],
};
}
});
}