UNPKG

it-tools-mcp

Version:

MCP-compliant server access to over 100 IT tools and utilities commonly used by developers, system administrators, and IT professionals.

30 lines (29 loc) 906 B
import { z } from "zod"; export function registerDecodeHtml(server) { server.registerTool("decode_html", { inputSchema: { text: z.string().describe("HTML encoded text to decode"), }, // VS Code compliance annotations annotations: { title: "Decode Html", readOnlyHint: false } }, async ({ text }) => { // Proper HTML decoding order: decode &amp; LAST to prevent double-unescaping const decoded = text .replace(/&lt;/g, '<') .replace(/&gt;/g, '>') .replace(/&quot;/g, '"') .replace(/&#39;/g, "'") .replace(/&amp;/g, '&'); // Decode ampersand LAST return { content: [ { type: "text", text: `HTML decoded: ${decoded}`, }, ], }; }); }