Skip to main content
Glama
tatumio

Tatum MCP Server

Official

gateway_execute_rpc

Execute RPC calls on specific blockchain networks via the Tatum MCP Server. Input chain, method, and parameters to interact with blockchain data and perform operations directly.

Instructions

[gateway] Execute an RPC call on a specific chain

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainYesThe blockchain to execute the RPC call on
methodYesThe RPC method to call
paramsNoThe parameters for the RPC call

Implementation Reference

  • The primary handler function implementing the gateway_execute_rpc tool logic. It resolves the gateway URL for the given chain, determines the protocol (REST or JSON-RPC), applies chain-specific formatting, and executes the request.
    public async executeChainRequest({
      chainName,
      method,
      params = []
    }: {
      chainName: string;
      method: string;
      params?: any[];
    }): Promise<TatumApiResponse> {
      try {
        const gatewayUrl = await this.getGatewayUrl(chainName);
        if (!gatewayUrl) {
          return {
            error: `Gateway URL not found for chain: ${chainName}`,
            status: 404,
            statusText: 'Not Found'
          };
        }
    
        const protocol = getChainProtocol(chainName);
        const apiConfig = getChainApiConfig(chainName);
        
        if (protocol === 'rest') {
          // For REST chains, enhance method handling with chain-specific configurations
          let restMethod = method;
          
          // Handle chain-specific method formatting
          if (!method.includes(' ') && !method.startsWith('GET') && !method.startsWith('POST')) {
            // Add base path prefix if configured
            if (apiConfig.basePathPrefix && !method.startsWith(apiConfig.basePathPrefix)) {
              restMethod = `GET ${apiConfig.basePathPrefix}/${method.replace(/^\//, '')}`;
            } else {
              restMethod = `GET /${method.replace(/^\//, '')}`;
            }
          }
          
          // Special handling for specific chains
          if (chainName.startsWith('kadena-')) {
            // Kadena requires specific path structure
            if (!method.includes('chainweb')) {
              const network = chainName.includes('testnet') ? 'testnet04' : 'mainnet01';
              restMethod = `GET /chainweb/0.0/${network}/${method.replace(/^\//, '')}`;
            }
          } else if (chainName.startsWith('cardano-')) {
            // Cardano uses Blockfrost API structure
            if (!method.includes('api/v0')) {
              restMethod = `GET /api/v0/${method.replace(/^\//, '')}`;
            }
          } else if (chainName.startsWith('flow-')) {
            // Flow uses specific v1 API structure
            if (!method.includes('v1')) {
              restMethod = `GET /v1/${method.replace(/^\//, '')}`;
            }
          }
          
          return await this.executeRestRequestWithConfig(gatewayUrl, restMethod, params, apiConfig);
        } else {
          // For JSON-RPC chains like Ethereum
          return await this.executeJsonRpcRequest(gatewayUrl, method, params);
        }
      } catch (error: any) {
        return {
          error: error.message || 'Request failed',
          status: error.status || 500,
          statusText: error.statusText || 'Error'
        };
      }
    }
  • Input schema and tool definition for gateway_execute_rpc, used for validation and tool listing.
    {
      name: 'gateway_execute_rpc',
      description: "Execute blockchain RPC calls through Tatum's gateway infrastructure. Supports both JSON-RPC and REST API calls depending on the blockchain. For JSON-RPC methods, use simple method names like 'getblockcount' or 'eth_getBalance'. For REST calls, use full HTTP method and path like 'POST /getnowblock'. Parameters should be provided as an array for JSON-RPC or object for REST calls.",
      inputSchema: {
        type: 'object',
        properties: {
          chain: {
            type: 'string',
            description: "The blockchain network identifier. Examples: 'bitcoin-mainnet', 'ethereum-mainnet', 'litecoin-mainnet', 'polygon-mainnet', 'tron-mainnet', 'bsc-mainnet'. Use gateway_get_supported_chains to see all available networks.",
            examples: ['bitcoin-mainnet', 'ethereum-mainnet', 'litecoin-mainnet', 'polygon-mainnet']
          },
          method: {
            type: 'string',
            description: "The RPC method or REST endpoint to call. For JSON-RPC: use method names like 'getblockcount', 'getbestblockhash', 'eth_getBalance', 'eth_blockNumber'. For REST: use HTTP method + path like 'POST /getnowblock', 'GET /getinfo'. The gateway will automatically detect the protocol based on the format. Use gateway_get_supported_methods to see all available methods.",
            examples: ['getblockcount', 'getbestblockhash', 'eth_getBalance', 'POST /getnowblock']
          },
          params: {
            type: 'array',
            description: "Parameters for the RPC method. For JSON-RPC: provide as array (e.g., ['0x742d35Cc6074C4532895c05b22629ce5b3c28da4', 'latest'] for eth_getBalance). For REST: provide as array with single object element. Leave empty array [] if no parameters needed.",
            items: {},
            default: []
          }
        },
        required: ['chain', 'method']
      }
    }
  • src/index.ts:91-100 (registration)
    Tool dispatch registration in the gateway tool switch statement, validating inputs and invoking the handler.
    case 'gateway_execute_rpc':
      if (!args.chain || !args.method) {
        throw new McpError(ErrorCode.InvalidParams, 'Missing required parameters: chain, method');
      }
      // Use the new intelligent chain request method
      return await this.gatewayService.executeChainRequest({
        chainName: args.chain,
        method: args.method,
        params: args.params || []
      });
  • src/index.ts:193-196 (registration)
    Registration of gateway tools (including schema) in the MCP listTools handler.
    ...GATEWAY_TOOLS.map(tool => ({
      name: tool.name,
      description: `[gateway] ${tool.description}`,
      inputSchema: tool.inputSchema
  • Helper function for executing JSON-RPC requests.
    private async executeJsonRpcRequest(url: string, method: string, params: any[] = []): Promise<TatumApiResponse> {
      const response = await fetch(url, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'X-API-Key': this.apiKey
        },
        body: JSON.stringify({
          jsonrpc: '2.0',
          id: 1,
          method,
          params
        })
      });
    
      const data = await response.json();
      return {
        data,
        status: response.status,
        statusText: response.statusText
      };
    }
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. It states the action 'execute an RPC call' but doesn't disclose behavioral traits like authentication requirements, rate limits, error handling, or what the response looks like. For a tool that performs network calls with potential side effects, this 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 action. There is zero wasted text, making it easy to parse quickly.

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 executing arbitrary RPC calls across blockchains, the description is insufficient. No annotations exist, there's no output schema, and it lacks details on supported chains, method validation, or response format. This leaves critical gaps for an agent to use the tool effectively.

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 (chain, method, params). The description adds no additional meaning beyond what's in the schema, such as examples of valid chains or methods. The baseline score of 3 reflects adequate but minimal value added.

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 verb 'execute' and resource 'RPC call on a specific chain', making the purpose understandable. It distinguishes this as a general RPC execution tool versus sibling tools that are chain-specific or perform specialized operations like gas estimation. However, it doesn't explicitly differentiate from all siblings (e.g., gateway_get_* tools).

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, appropriate contexts, or exclusions, leaving the agent to infer usage from the tool name and parameters 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

Related 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/tatumio/tatum-mcp'

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