html_decode
Convert HTML-encoded strings back to readable text by decoding entities like & and < into their original characters.
Instructions
Decode HTML entities in a string back to their original characters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | The HTML-encoded string to decode |
Implementation Reference
- src/tools/encoding.ts:93-108 (handler)The 'html_decode' tool is registered and implemented directly within the registerEncodingTools function in src/tools/encoding.ts, using a series of string replacements to decode common HTML entities.
server.tool( "html_decode", "Decode HTML entities in a string back to their original characters.", { input: z.string().describe("The HTML-encoded string to decode") }, async ({ input }) => { const decoded = input .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, '"') .replace(/'/g, "'") .replace(/'/g, "'") .replace(///g, "/"); return { content: [{ type: "text" as const, text: decoded }] }; } );