Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

call_contract_view

Query read-only smart contract functions to retrieve blockchain data without executing transactions, supporting multiple networks through Grove's Pocket Network integration.

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

  • Core handler implementation that executes the read-only contract function call via eth_call RPC on the blockchain service.
    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', ] ); }
  • MCP dispatch handler for 'call_contract_view' tool: extracts arguments from input and calls the blockchain service method.
    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, }; }
  • MCP tool registration definition including name, description, and input schema validation.
    { 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'], }, },

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