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
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | hex to decode |
Implementation Reference
- src/service/hex.ts:65-75 (handler)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, }, ], }; }
- src/service/hex.ts:62-64 (schema)Zod schema defining the input for hex_decode: a string 'content' which is the hex to decode.{ content: z.string().describe("hex to decode"), },
- src/service/hex.ts:59-76 (registration)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, }, ], }; } );
- src/service/hex.ts:24-30 (helper)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; }