Skip to main content
Glama

hex_decode

Convert hexadecimal encoded data back to readable text format. This tool decodes hex strings to their original text representation for data interpretation.

Instructions

decode hex to text

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYeshex to decode

Implementation Reference

  • The handler function for the 'hex_decode' tool. It receives the hex string in 'content', 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, }, ], }; }
  • The input schema for the 'hex_decode' tool, defining 'content' as a string (the hex to decode). Uses Zod for validation.
    { content: z.string().describe("hex to decode"), },
  • The registration of the 'hex_decode' tool on the MCP server, specifying name, description, input schema, and handler function.
    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, }, ], }; } );
  • The HexUtil.hexToString helper method that implements the core logic of decoding a hexadecimal string into the original text 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; }

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