Skip to main content
Glama
pokt-network

Grove Public Endpoints MCP Server

Official
by pokt-network

call_contract_view

Execute read-only smart contract functions to retrieve blockchain data without modifying state, supporting Ethereum, Solana, Cosmos, and Layer 2 networks through Grove's public endpoints.

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

  • Registers the 'call_contract_view' MCP tool with name, description, and input schema definition
    {
      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 'call_contract_view' tool: extracts arguments, calls AdvancedBlockchainService.callContractView, formats and returns the result as MCP response
    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,
      };
    }
  • Core implementation: performs 'eth_call' RPC call to the contract address with the provided calldata on the specified blockchain and network
    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',
        ]
      );
    }

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