Skip to main content
Glama

html-decode

Convert HTML entities back into readable text using this decoding tool. Ideal for developers working with encoded HTML content.

Instructions

Decode HTML entities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesHTML encoded text to decode

Implementation Reference

  • The handler function that decodes HTML entities by replacing <, >, ", ', and & in the correct order to avoid double-unescaping.
    }, 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}`, }, ], }; }
  • Input schema for the tool, requiring a 'text' string parameter containing HTML encoded text.
    inputSchema: { text: z.string().describe("HTML encoded text to decode"), },
  • Registration function that sets up the 'decode_html' tool on the MCP server, including description, schema, annotations, and handler.
    export function registerDecodeHtml(server: McpServer) { server.registerTool("decode_html", { description: "Decode HTML entities", inputSchema: { text: z.string().describe("HTML encoded text to decode"), }, // VS Code compliance annotations annotations: { title: "Decode Html", description: "Decode HTML entities", 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}`, }, ], }; } ); }

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