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'],
      },
    },
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: 'SUPPORTS: 55+ methods including eth_*, web3_*, net_*, debug_*' (scope), 'DECODES: Results automatically converted to human-readable format' (output processing), and 'USE FOR: EVM-compatible operations... transaction submission' (capabilities). However, it doesn't mention rate limits, authentication requirements, or error handling patterns.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly structured with clear sections (SUPPORTS, EXAMPLES, DECODES, USE FOR) and every sentence earns its place. It's front-loaded with the core purpose, uses bullet-like formatting for readability, and contains zero wasted words while conveying essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 3 parameters, 100% schema coverage, but no annotations and no output schema, the description does well by explaining scope (55+ methods), providing examples, describing output processing (decoding), and giving usage guidelines. However, it could better address the lack of output schema by describing typical return formats or error patterns for this RPC interface.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds minimal value beyond the schema - it provides example method names ('eth_blockNumber, eth_getBalance, eth_call, eth_getLogs, eth_sendRawTransaction') which help illustrate the 'method' parameter, but doesn't add significant semantic context about parameter usage or constraints beyond what's in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Execute ANY JSON-RPC method') and resources ('on Hedera's JSON-RPC Relay'). It explicitly distinguishes this tool from siblings like rpc_call_contract, rpc_deploy_contract, and rpc_execute_contract by emphasizing its general-purpose nature for ANY JSON-RPC method rather than contract-specific operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance with 'USE FOR: EVM-compatible operations, blockchain state queries, transaction submission.' It distinguishes when to use this tool (general JSON-RPC) versus contract-specific siblings (rpc_call_contract, etc.) and lists example methods to clarify appropriate use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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