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, '&')
        .replace(/</g, '<')
        .replace(/>/g, '>')
        .replace(/"/g, '"')
        .replace(/'/g, ''');
      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, '&')
          .replace(/</g, '<')
          .replace(/>/g, '>')
          .replace(/"/g, '"')
          .replace(/'/g, ''');
        return {
          content: [
            {
              type: 'text',
              text: encoded
            }
          ]
        };
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action 'encode' but doesn't disclose behavioral traits like whether it's idempotent, what happens with invalid input (e.g., null or non-string), error handling, or performance characteristics. For a transformation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and format, making it easy to parse. Every word earns its place by conveying essential information without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, no output schema, no annotations), the description is minimally complete. It states what the tool does but lacks context on usage, behavior, or output. For a simple encoder, this might suffice, but it doesn't fully compensate for the absence of annotations or output schema, leaving the agent to guess about results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'input' documented as 'Data to encode'. The description adds no additional meaning beyond this, such as examples of what constitutes valid input or encoding specifics (e.g., which characters are encoded). Baseline 3 is appropriate since the schema adequately covers the parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'encode' and the resource 'input data' with the target format 'HTML-encoded format'. It distinguishes from siblings like encodeBase64 and encodeUrl by specifying HTML encoding, though it doesn't explicitly contrast them. The purpose is specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like encodeBase64 or encodeUrl. It doesn't mention use cases (e.g., sanitizing user input for web display) or prerequisites. Without context, the agent must infer usage from the name and sibling tools alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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