decodeHtml
Convert HTML-encoded data back to its original format using this utility. Ideal for handling encoded strings from web sources or APIs.
Instructions
Decode HTML-encoded input data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Data to decode |
Implementation Reference
- src/tools/encoding.ts:145-160 (handler)The handler function that decodes HTML-encoded input by replacing common HTML entities back to their original characters.handler: async ({ input }: { input: string }) => { const decoded = input .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, "'"); return { content: [ { type: 'text', text: decoded } ] }; }
- src/tools/encoding.ts:135-144 (schema)Input schema defining the expected 'input' parameter as a string for the decodeHtml tool.inputSchema: { type: 'object', properties: { input: { type: 'string', description: 'Data to decode' } }, required: ['input'] },
- src/tools/encoding.ts:132-161 (registration)The complete registration of the 'decodeHtml' tool within the encodingTools object, including name, description, schema, and handler.decodeHtml: { name: 'decodeHtml', description: 'Decode HTML-encoded input data', inputSchema: { type: 'object', properties: { input: { type: 'string', description: 'Data to decode' } }, required: ['input'] }, handler: async ({ input }: { input: string }) => { const decoded = input .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, "'"); return { content: [ { type: 'text', text: decoded } ] }; } }