Skip to main content
Glama

rpc_call

Execute JSON-RPC methods on Hedera's blockchain to query state, submit transactions, and perform EVM-compatible operations with automatic result decoding.

Instructions

Execute ANY JSON-RPC method on Hedera's JSON-RPC Relay.

SUPPORTS: 55+ methods including eth_, web3_, net_, debug_ EXAMPLES: eth_blockNumber, eth_getBalance, eth_call, eth_getLogs, eth_sendRawTransaction DECODES: Results automatically converted to human-readable format

USE FOR: EVM-compatible operations, blockchain state queries, transaction submission.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodYesRPC method name (e.g., "eth_blockNumber")
paramsNoMethod parameters as array
networkNoTarget network (default: current)

Implementation Reference

  • The primary handler function that executes any JSON-RPC method on Hedera, handling the core logic including service calls, decoding, error handling, and response formatting.
    export async function rpcCall(args: { method: string; params?: any[]; network?: 'mainnet' | 'testnet' | 'previewnet' | 'local'; }): Promise<ToolResult> { try { logger.info('Executing generic RPC call', { method: args.method, network: args.network }); const response = await jsonRpcService.callWithDetails( args.method, args.params || [], args.network ); // Build output with full details const data: any = { method: args.method, result: response.result, // Raw result from RPC }; // Add decoded values if available if (response.decoded) { data.decoded = response.decoded; } // Add full RPC response data.rpc_response = response.raw; return { success: true, data, metadata: { executedVia: 'json_rpc_relay', command: `rpc ${args.method}`, network: args.network || 'current', }, }; } catch (error) { logger.error('Generic RPC call failed', { error, method: args.method }); return { success: false, error: error instanceof Error ? error.message : 'Unknown error occurred', metadata: { executedVia: 'json_rpc_relay', command: `rpc ${args.method}`, }, }; } }
  • The tool schema definition for 'rpc_call' used in the MCP tool listing (ListToolsRequest), including name, description, and input validation schema.
    { name: 'rpc_call', description: `Execute ANY JSON-RPC method on Hedera's JSON-RPC Relay. SUPPORTS: 55+ methods including eth_*, web3_*, net_*, debug_* EXAMPLES: eth_blockNumber, eth_getBalance, eth_call, eth_getLogs, eth_sendRawTransaction DECODES: Results automatically converted to human-readable format USE FOR: EVM-compatible operations, blockchain state queries, transaction submission.`, inputSchema: { type: 'object' as const, properties: { method: { type: 'string', description: 'RPC method name (e.g., "eth_blockNumber")' }, params: { type: 'array', items: {}, description: 'Method parameters as array', }, network: { type: 'string', enum: ['mainnet', 'testnet', 'previewnet', 'local'], description: 'Target network (default: current)', }, }, required: ['method'], }, },
  • src/index.ts:605-607 (registration)
    The dispatch registration in the main tool execution switch statement that routes 'rpc_call' calls to the rpcCall handler function.
    case 'rpc_call': result = await rpcCall(args as any); break;
  • src/index.ts:48-48 (registration)
    Import statement that brings the rpcCall handler into the main index file for use in tool dispatching.
    import { rpcCall, rpcCallContract, rpcDeployContract, rpcExecuteContract } from './tools/rpc.js';
  • Alternative/internal tool schema definition for 'rpc_call' exported in rpcTools array within the rpc module.
    name: 'rpc_call', description: 'Execute any JSON-RPC method on Hedera. Supports all 55+ methods from OpenRPC spec including eth_*, web3_*, net_*, debug_*. Examples: eth_blockNumber, eth_getBalance, eth_call, eth_sendRawTransaction, eth_getLogs, debug_traceTransaction, etc.', inputSchema: { type: 'object' as const, properties: { method: { type: 'string', description: 'RPC method name (e.g., "eth_blockNumber", "eth_getBalance", "eth_call", "eth_getLogs")', }, params: { type: 'array', description: 'Method-specific parameters as array', items: {}, }, network: { type: 'string', enum: ['mainnet', 'testnet', 'previewnet', 'local'], description: 'Target network (default: current network)', }, }, required: ['method'], }, },

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/justmert/hashpilot'

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