Skip to main content
Glama
pokt-network

Grove Public Endpoints MCP Server

Official
by pokt-network

call_rpc_method

Execute JSON-RPC methods on blockchain networks using Grove's public endpoints. Specify blockchain, method, and parameters to interact with Ethereum, Solana, Cosmos, and Layer 2 solutions without authentication.

Instructions

Call a JSON-RPC method on a specific blockchain service

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockchainYesBlockchain name (e.g., "ethereum", "polygon")
methodYesRPC method name (e.g., "eth_blockNumber", "eth_getBalance")
paramsNoArray of parameters for the RPC method
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • Main handler execution logic for the 'call_rpc_method' tool. Performs safety validation, retrieves the appropriate blockchain service, and calls the underlying callRPCMethod.
    case 'call_rpc_method': {
      const blockchain = args?.blockchain as string;
      const method = args?.method as string;
      const params = (args?.params as any[]) || [];
      const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet';
    
      // SAFETY CHECK: Validate RPC call before execution
      const safetyCheck = validateRPCCall(blockchain, method, params);
      if (!safetyCheck.safe) {
        return {
          content: [
            {
              type: 'text',
              text: `⛔ UNSAFE RPC CALL BLOCKED\n\n` +
                    `Reason: ${safetyCheck.reason}\n\n` +
                    `Suggestion: ${safetyCheck.suggestion}\n\n` +
                    `This protection prevents session crashes from large responses.`,
            },
          ],
          isError: true,
        };
      }
    
      const service = blockchainService.getServiceByBlockchain(blockchain, network);
    
      if (!service) {
        return {
          content: [
            {
              type: 'text',
              text: `Blockchain service not found: ${blockchain} (${network})`,
            },
          ],
          isError: true,
        };
      }
    
      const result = await blockchainService.callRPCMethod(service.id, method, params);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
        isError: !result.success,
      };
    }
  • Tool schema definition for 'call_rpc_method', specifying input parameters and validation rules.
      name: 'call_rpc_method',
      description: 'Call a JSON-RPC method on a specific blockchain service',
      inputSchema: {
        type: 'object',
        properties: {
          blockchain: {
            type: 'string',
            description: 'Blockchain name (e.g., "ethereum", "polygon")',
          },
          method: {
            type: 'string',
            description: 'RPC method name (e.g., "eth_blockNumber", "eth_getBalance")',
          },
          params: {
            type: 'array',
            description: 'Array of parameters for the RPC method',
          },
          network: {
            type: 'string',
            enum: ['mainnet', 'testnet'],
            description: 'Network type (defaults to mainnet)',
          },
        },
        required: ['blockchain', 'method'],
      },
    },
  • src/index.ts:88-101 (registration)
    Registration of tools on the MCP server, including 'call_rpc_method' via registerBlockchainHandlers call. The tools list is used for listTools and dispatch to handlers.
    const tools: Tool[] = [
      ...registerBlockchainHandlers(server, blockchainService),
      ...registerDomainHandlers(server, domainResolver),
      ...registerTransactionHandlers(server, advancedBlockchain),
      ...registerTokenHandlers(server, advancedBlockchain),
      ...registerMultichainHandlers(server, advancedBlockchain),
      ...registerContractHandlers(server, advancedBlockchain),
      ...registerUtilityHandlers(server, advancedBlockchain),
      ...registerEndpointHandlers(server, endpointManager),
      ...registerSolanaHandlers(server, solanaService),
      ...registerCosmosHandlers(server, cosmosService),
      ...registerSuiHandlers(server, suiService),
      ...registerDocsHandlers(server, docsManager),
    ];
  • Core helper function callRPCMethod that executes the actual JSON-RPC HTTP request to the blockchain service endpoint, handles HTTP/JSON-RPC errors, and returns structured response.
    async callRPCMethod(
      serviceId: string,
      method: string,
      params: any[] = []
    ): Promise<EndpointResponse> {
      const service = this.getServiceById(serviceId);
      if (!service) {
        return {
          success: false,
          error: `Service not found: ${serviceId}`,
        };
      }
    
      const rpcUrl = service.rpcUrl;
    
      try {
        const response = await fetch(rpcUrl, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
          },
          body: JSON.stringify({
            jsonrpc: '2.0',
            method,
            params,
            id: 1,
          }),
        });
    
        // Handle HTTP errors (rate limiting, server errors, etc.)
        if (!response.ok) {
          const errorText = await response.text().catch(() => 'Unable to read error response');
          let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
    
          // Common HTTP error interpretations
          if (response.status === 429) {
            errorMessage = `Rate limit exceeded (HTTP 429). The endpoint may be experiencing high traffic.`;
          } else if (response.status === 503) {
            errorMessage = `Service temporarily unavailable (HTTP 503). The endpoint may be overloaded.`;
          } else if (response.status >= 500) {
            errorMessage = `Server error (HTTP ${response.status}). The RPC endpoint encountered an internal error.`;
          }
    
          return {
            success: false,
            error: errorMessage,
            data: {
              httpStatus: response.status,
              httpStatusText: response.statusText,
              responseBody: errorText.substring(0, 500), // Limit error body size
            },
            metadata: {
              timestamp: new Date().toISOString(),
              endpoint: rpcUrl,
            },
          };
        }
    
        const data = await response.json();
    
        // Handle JSON-RPC errors
        if (data.error) {
          return {
            success: false,
            error: data.error.message || 'RPC error',
            data: data.error,
            metadata: {
              timestamp: new Date().toISOString(),
              endpoint: rpcUrl,
            },
          };
        }
    
        return {
          success: true,
          data: data.result,
          metadata: {
            timestamp: new Date().toISOString(),
            endpoint: rpcUrl,
          },
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error',
          data: {
            errorType: error instanceof Error ? error.constructor.name : 'UnknownError',
            errorStack: error instanceof Error ? error.stack : undefined,
          },
          metadata: {
            timestamp: new Date().toISOString(),
            endpoint: rpcUrl,
          },
        };
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Call a JSON-RPC method') but doesn't describe key traits: it doesn't specify if this is a read-only or mutating operation (though RPC methods can include writes), potential side effects, authentication requirements, rate limits, error handling, or response format. For a tool with no annotations and potential write capabilities, this lack of detail is a significant gap.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. It directly states 'Call a JSON-RPC method on a specific blockchain service,' which is clear and to the point. There's no redundancy or fluff, making it highly concise and well-structured for quick understanding.

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

Completeness2/5

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

Given the complexity of calling RPC methods (which can involve reads or writes), the lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like safety, response format, or error cases, and it omits usage guidelines relative to many siblings. For a tool with 4 parameters and potential mutation risks, more context is needed to ensure safe and effective use by an agent.

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?

The description adds no parameter semantics beyond what the input schema provides. The schema has 100% description coverage, with clear docs for each parameter (e.g., 'blockchain' as the name, 'method' as the RPC method name). Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate with additional context like example usage or parameter interactions.

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

Purpose4/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: 'Call a JSON-RPC method on a specific blockchain service.' It specifies the verb ('Call') and resource ('JSON-RPC method'), and distinguishes it from siblings like 'call_contract_view' or 'call_endpoint' by focusing on raw RPC calls rather than contract interactions or generic endpoints. However, it doesn't explicitly contrast with all similar tools, such as 'query_blockchain', which might also involve RPC-like queries.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to prefer this over siblings like 'call_contract_view' for contract reads, 'query_blockchain' for broader queries, or other blockchain-specific tools (e.g., 'get_block_details'). There's no context on prerequisites, such as needing a valid blockchain service, or exclusions, leaving the agent to infer usage from the tool name alone.

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/pokt-network/mcp'

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