Skip to main content
Glama

encodeHtml

Convert plain text or data into HTML-encoded format to ensure compatibility and security in web applications.

Instructions

Encode input data to HTML-encoded format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesData to encode

Implementation Reference

  • The asynchronous handler function that implements the core logic of the encodeHtml tool, replacing special HTML characters with their entity equivalents.
    handler: async ({ input }: { input: string }) => { const encoded = input .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/'/g, '&#039;'); return { content: [ { type: 'text', text: encoded } ] }; }
  • The input schema defining the expected arguments for the encodeHtml tool: a required string 'input'.
    inputSchema: { type: 'object', properties: { input: { type: 'string', description: 'Data to encode' } }, required: ['input'] },
  • The complete definition of the encodeHtml tool, including name, description, schema, and handler, exported as part of encodingTools for registration in the main server.
    encodeHtml: { name: 'encodeHtml', description: 'Encode input data to HTML-encoded format', inputSchema: { type: 'object', properties: { input: { type: 'string', description: 'Data to encode' } }, required: ['input'] }, handler: async ({ input }: { input: string }) => { const encoded = input .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/'/g, '&#039;'); return { content: [ { type: 'text', text: encoded } ] }; } },

Other Tools

Related Tools

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/MissionSquad/mcp-helper-tools'

If you have feedback or need assistance with the MCP directory API, please join our Discord server