query_blockchain
Execute natural language queries to access blockchain data across 70+ networks including Ethereum, Solana, and Cosmos for token analytics, transaction inspection, and multi-chain comparisons.
Instructions
Execute a natural language query to interact with blockchain data (e.g., "get the latest height for ethereum")
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural language query describing what you want to do |
Implementation Reference
- Handler execution logic for the 'query_blockchain' tool. Extracts the query argument and delegates to BlockchainRPCService.executeQuery, then formats the response.case 'query_blockchain': { const query = args?.query as string; const result = await blockchainService.executeQuery(query); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- src/handlers/blockchain-handlers.ts:15-28 (registration)Tool registration definition including name, description, and input schema for 'query_blockchain' returned by registerBlockchainHandlers function.{ name: 'query_blockchain', description: 'Execute a natural language query to interact with blockchain data (e.g., "get the latest height for ethereum")', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Natural language query describing what you want to do', }, }, required: ['query'], }, },
- Input schema definition for the 'query_blockchain' tool, specifying a required 'query' string parameter.{ name: 'query_blockchain', description: 'Execute a natural language query to interact with blockchain data (e.g., "get the latest height for ethereum")', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Natural language query describing what you want to do', }, }, required: ['query'], }, },
- Supporting utility method executeQuery in BlockchainRPCService that implements the core natural language query processing: parsing, method matching, parameter building, and RPC execution.async executeQuery(query: string): Promise<EndpointResponse> { const parsed = this.parseQuery(query); const matches = this.findMethodByQuery(parsed.intent); if (matches.length === 0) { return { success: false, error: `No matching methods found for query: "${query}"`, }; } // Filter by blockchain if specified let filteredMatches = matches; if (parsed.blockchain) { filteredMatches = matches.filter( m => m.service.blockchain === parsed.blockchain ); if (filteredMatches.length === 0) { filteredMatches = matches; // Fall back to all matches } } // Use the first match const { method, service } = filteredMatches[0]; // Build params based on method requirements const params = this.buildParamsForMethod(method, query); return this.callRPCMethod(service.id, method.name, params); }