Skip to main content
Glama

hex_decode

Decode hexadecimal strings into readable text using this tool as part of the Crypto_MCP server, designed for secure data conversion in encryption workflows.

Instructions

decode hex to text

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYeshex to decode

Implementation Reference

  • Handler function for the hex_decode tool. It takes a hex string input, decodes it using HexUtil.hexToString, and returns the result as text content.
    async ({ content }: { content: string }) => { const result = HexUtil.hexToString(content); return { content: [ { type: "text", text: result, }, ], }; }
  • Zod schema defining the input for hex_decode: a string 'content' which is the hex to decode.
    { content: z.string().describe("hex to decode"), },
  • Registration of the hex_decode tool on the McpServer instance using server.tool, including name, description, schema, and handler.
    server.tool( "hex_decode", "decode hex to text", { content: z.string().describe("hex to decode"), }, async ({ content }: { content: string }) => { const result = HexUtil.hexToString(content); return { content: [ { type: "text", text: result, }, ], }; } );
  • HexUtil.hexToString static method: implements the core hex decoding logic by parsing pairs of hex digits into character codes.
    static hexToString(hex: string): string { let str = ''; for (let i = 0; i < hex.length; i += 2) { str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); } return str; }

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