Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

query_blockchain

Execute natural language queries to retrieve blockchain data across 70+ networks including Ethereum, Solana, Cosmos, and Sui. Access token analytics, transaction details, domain resolution, 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
NameRequiredDescriptionDefault
queryYesNatural language query describing what you want to do

Implementation Reference

  • Defines the tool name, description, and input schema (natural language query) for 'query_blockchain'.
    {
      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'],
      },
  • Handler logic for 'query_blockchain': performs safety validation on the query, calls BlockchainRPCService.executeQuery(), formats and returns the RPC result.
    case 'query_blockchain': {
      const query = args?.query as string;
      
      // SAFETY CHECK: Validate query before execution
      const safetyCheck = validateNaturalLanguageQuery(query);
      if (!safetyCheck.safe) {
        return {
          content: [
            {
              type: 'text',
              text: `⛔ UNSAFE QUERY BLOCKED\n\n` +
                    `Reason: ${safetyCheck.reason}\n\n` +
                    `Suggestion: ${safetyCheck.suggestion}\n\n` +
                    `This protection prevents session crashes from large responses.`,
            },
          ],
          isError: true,
        };
      }
      
      const result = await blockchainService.executeQuery(query);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
        isError: !result.success,
      };
    }
  • Core implementation delegated by handler: parses natural language query, matches to RPC method/service, builds parameters, executes RPC call via callRPCMethod.
    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);
    }
  • src/index.ts:88-101 (registration)
    Registers the blockchain tools (including query_blockchain schema) by collecting from registerBlockchainHandlers and setting up listTools handler.
    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),
    ];
  • src/index.ts:114-126 (registration)
    Dispatches tool calls to handleBlockchainTool (first in sequence), which handles query_blockchain via switch case.
    let result =
      (await handleBlockchainTool(name, args, blockchainService)) ||
      (await handleDomainTool(name, args, domainResolver)) ||
      (await handleTransactionTool(name, args, advancedBlockchain)) ||
      (await handleTokenTool(name, args, advancedBlockchain)) ||
      (await handleMultichainTool(name, args, advancedBlockchain)) ||
      (await handleContractTool(name, args, advancedBlockchain)) ||
      (await handleUtilityTool(name, args, advancedBlockchain)) ||
      (await handleEndpointTool(name, args, endpointManager)) ||
      (await handleSolanaTool(name, args, solanaService)) ||
      (await handleCosmosTool(name, args, cosmosService)) ||
      (await handleSuiTool(name, args, suiService)) ||
      (await handleDocsTool(name, args, docsManager));
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 mentions 'execute a natural language query' but lacks critical behavioral details: what types of queries are supported, how results are formatted, whether it's read-only or has side effects, error handling, or performance characteristics. This leaves significant gaps for an agent to understand the tool's behavior.

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

Conciseness4/5

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

The description is a single, efficient sentence with a helpful example. It is front-loaded with the core purpose and avoids unnecessary words, though it could be slightly more structured by explicitly separating the example or adding brief context.

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 blockchain interactions and the lack of annotations and output schema, the description is insufficient. It does not explain what the tool returns, how to interpret results, or the scope of supported queries (e.g., which blockchains, data types). For a tool with one parameter but potentially broad and undefined behavior, more context is needed to be complete.

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%, with the parameter 'query' fully documented in the schema as 'Natural language query describing what you want to do'. The description adds minimal value beyond this, only providing an example ('e.g., "get the latest height for ethereum"') but no additional syntax, format, or constraint details. This meets the baseline for high schema coverage.

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: 'Execute a natural language query to interact with blockchain data' with a specific example. It uses a verb ('execute') and resource ('blockchain data'), but does not explicitly differentiate it from its many siblings (e.g., get_block_details, query_sui_events) which also interact with blockchain data in more specific ways.

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. With numerous sibling tools for specific blockchain operations (e.g., get_block_details, get_token_balance), there is no indication of when a natural language query is preferred over these targeted tools, nor any prerequisites or exclusions mentioned.

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/buildwithgrove/mcp-pocket'

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