Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

call_contract_view

Retrieve blockchain contract data by calling read-only functions across multiple networks to access token balances, transaction details, and smart contract information.

Instructions

Call a read-only contract function

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockchainYesBlockchain name
contractAddressYesContract address
dataYesEncoded function call data
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • Defines the tool schema including input parameters for call_contract_view
    {
      name: 'call_contract_view',
      description: 'Call a read-only contract function',
      inputSchema: {
        type: 'object',
        properties: {
          blockchain: {
            type: 'string',
            description: 'Blockchain name',
          },
          contractAddress: {
            type: 'string',
            description: 'Contract address',
          },
          data: {
            type: 'string',
            description: 'Encoded function call data',
          },
          network: {
            type: 'string',
            enum: ['mainnet', 'testnet'],
            description: 'Network type (defaults to mainnet)',
          },
        },
        required: ['blockchain', 'contractAddress', 'data'],
      },
    },
  • Handler logic for executing the call_contract_view tool, delegates to advancedBlockchain service
    case 'call_contract_view': {
      const blockchain = args?.blockchain as string;
      const contractAddress = args?.contractAddress as string;
      const data = args?.data as string;
      const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet';
    
      const result = await advancedBlockchain.callContractView(
        blockchain,
        contractAddress,
        data,
        network
      );
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
        isError: !result.success,
      };
    }
  • src/index.ts:88-101 (registration)
    Registers all tool schemas including call_contract_view via registerContractHandlers for the ListTools endpoint
    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),
    ];
  • Central tool dispatcher that routes call_contract_view to handleContractTool
    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));
  • Core implementation that performs the eth_call RPC to call the contract view function
    async callContractView(
      blockchain: string,
      contractAddress: string,
      data: string,
      network: 'mainnet' | 'testnet' = 'mainnet'
    ): Promise<EndpointResponse> {
      const service = this.blockchainService.getServiceByBlockchain(blockchain, network);
    
      if (!service) {
        return {
          success: false,
          error: `Blockchain service not found: ${blockchain} (${network})`,
        };
      }
    
      return this.blockchainService.callRPCMethod(
        service.id,
        'eth_call',
        [
          {
            to: contractAddress,
            data: data,
          },
          'latest',
        ]
      );
    }
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. While 'read-only' indicates this is a safe operation that doesn't modify state, it doesn't disclose important behavioral traits like what blockchain networks are supported, whether authentication is required, rate limits, error handling, or what the response format looks like. The description is minimal and lacks necessary context for a tool interacting with blockchain contracts.

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 with zero wasted words. It's appropriately sized for a tool with good schema documentation and gets straight to the point without unnecessary elaboration.

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 that this is a blockchain interaction tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what 'read-only contract function' means in practical terms, what the expected return format is, or provide any context about blockchain-specific considerations. For a tool that presumably returns complex contract data, more guidance is needed.

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 four parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. The baseline score of 3 is appropriate when the schema does all the parameter documentation work.

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 read-only contract function'. It specifies the verb ('call') and resource ('contract function') with the qualifier 'read-only'. However, it doesn't distinguish this tool from potential siblings like 'call_endpoint' or 'call_rpc_method' that might also involve calling functions.

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 many sibling tools available (like 'call_endpoint', 'call_rpc_method', 'query_blockchain'), there's no indication of what makes this tool specifically appropriate for read-only contract functions versus other calling or querying operations.

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