Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

decode_hex

Convert hexadecimal strings into readable UTF-8 text, ASCII characters, or raw byte data for blockchain transaction analysis and data interpretation.

Instructions

Decode hex string to UTF-8, ASCII, and bytes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hexYesHex string to decode

Implementation Reference

  • Handler case in handleUtilityTool that processes 'decode_hex' tool calls by extracting 'hex' argument and delegating to AdvancedBlockchainService.decodeHex, then formatting the response.
    case 'decode_hex': { const hex = args?.hex as string; const result = advancedBlockchain.decodeHex(hex); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
  • Tool schema definition including name, description, and input schema requiring a 'hex' string parameter.
    { name: 'decode_hex', description: 'Decode hex string to UTF-8, ASCII, and bytes', inputSchema: { type: 'object', properties: { hex: { type: 'string', description: 'Hex string to decode', }, }, required: ['hex'], }, },
  • Registration of utility tools including 'decode_hex' in registerUtilityHandlers function that returns the tools array for MCP server registration.
    const tools: Tool[] = [ { name: 'convert_units', description: 'Convert between wei, gwei, and eth units', inputSchema: { type: 'object', properties: { value: { type: 'string', description: 'Value to convert', }, fromUnit: { type: 'string', enum: ['wei', 'gwei', 'eth'], description: 'Source unit', }, toUnit: { type: 'string', enum: ['wei', 'gwei', 'eth'], description: 'Target unit', }, }, required: ['value', 'fromUnit', 'toUnit'], }, }, { name: 'validate_address', description: 'Validate address format for a specific blockchain', inputSchema: { type: 'object', properties: { address: { type: 'string', description: 'Address to validate', }, blockchain: { type: 'string', description: 'Blockchain name', }, }, required: ['address', 'blockchain'], }, }, { name: 'decode_hex', description: 'Decode hex string to UTF-8, ASCII, and bytes', inputSchema: { type: 'object', properties: { hex: { type: 'string', description: 'Hex string to decode', }, }, required: ['hex'], }, }, ]; return tools; }
  • Core implementation of hex decoding in AdvancedBlockchainService: cleans hex input, converts to bytes using Buffer, decodes to UTF-8 and ASCII, returns structured response.
    decodeHex(hex: string): EndpointResponse { try { const cleanHex = hex.startsWith('0x') ? hex.slice(2) : hex; const bytes = Buffer.from(cleanHex, 'hex'); const utf8 = bytes.toString('utf8'); const ascii = bytes.toString('ascii'); return { success: true, data: { hex, utf8, ascii, bytes: Array.from(bytes), length: bytes.length, }, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to decode hex', }; } }

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/buildwithgrove/mcp-pocket'

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