Skip to main content
Glama

hex_encode

Convert text into hexadecimal format for secure data handling and compatibility with cryptographic processes in the Crypto_MCP server.

Instructions

encode text to hex

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYestext to encode

Implementation Reference

  • The asynchronous handler function that executes the hex_encode tool. It takes the input 'content' string, encodes it to hexadecimal using HexUtil.stringToHex, and returns the result as a text content block.
    async ({ content }: { content: string }) => { const result = HexUtil.stringToHex(content); return { content: [ { type: "text", text: result, }, ], }; }
  • The input schema for the hex_encode tool, defining a single 'content' parameter as a string to be encoded.
    { content: z.string().describe("text to encode"), },
  • The direct registration of the 'hex_encode' tool on the McpServer, including name, description, schema, and handler.
    server.tool( "hex_encode", "encode text to hex", { content: z.string().describe("text to encode"), }, async ({ content }: { content: string }) => { const result = HexUtil.stringToHex(content); return { content: [ { type: "text", text: result, }, ], }; } );
  • The HexUtil.stringToHex helper method that performs the core logic of converting a string to its hexadecimal representation.
    static stringToHex(str: string): string { return Array.from(str) .map(char => char.charCodeAt(0).toString(16).padStart(2, '0')) .join(''); }
  • src/index.ts:19-19 (registration)
    Top-level call to registerHexTool, which in turn registers the hex_encode tool (among others) on the main McpServer instance.
    registerHexTool(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/1595901624/crypto-mcp'

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