hex_encode
Convert text to hexadecimal format for secure data encoding and compatibility with cryptographic operations in the Crypto_MCP server.
Instructions
encode text to hex
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | text to encode |
Implementation Reference
- src/service/hex.ts:45-55 (handler)The async handler function that encodes the input string to hexadecimal using HexUtil.stringToHex and returns it as text content.async ({ content }: { content: string }) => { const result = HexUtil.stringToHex(content); return { content: [ { type: "text", text: result, }, ], }; }
- src/service/hex.ts:42-44 (schema)Zod input schema defining the 'content' parameter as a string to encode to hex.{ content: z.string().describe("text to encode"), },
- src/service/hex.ts:40-56 (registration)Registration of the 'hex_encode' tool using server.tool, including name, description, schema, and handler."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, }, ], }; } );
- src/service/hex.ts:13-17 (helper)Core helper method that performs the string to hex encoding logic used by the tool handler.static stringToHex(str: string): string { return Array.from(str) .map(char => char.charCodeAt(0).toString(16).padStart(2, '0')) .join(''); }