Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_historical_balance

Retrieve cryptocurrency balance for any address at a specific block height across multiple blockchain networks including Ethereum, Solana, Cosmos, and Sui.

Instructions

Get balance at a specific block height

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesAddress to check
blockNumberYesBlock number
blockchainYesBlockchain name
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • Handler logic for executing the get_historical_balance tool: extracts parameters, calls the service method, and formats the response.
    case 'get_historical_balance': { const blockchain = args?.blockchain as string; const address = args?.address as string; const blockNumber = args?.blockNumber as string | number; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await advancedBlockchain.getHistoricalBalance( blockchain, address, blockNumber, network ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
  • Input schema defining parameters for the get_historical_balance tool.
    inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, address: { type: 'string', description: 'Address to check', }, blockNumber: { description: 'Block number', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'address', 'blockNumber'], },
  • Tool registration entry in the multichain tools array, including name, description, and schema.
    { name: 'get_historical_balance', description: 'Get balance at a specific block height', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, address: { type: 'string', description: 'Address to check', }, blockNumber: { description: 'Block number', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'address', 'blockNumber'], }, },
  • Core implementation of historical balance retrieval using eth_getBalance RPC at specific block.
    async getHistoricalBalance( blockchain: string, address: string, blockNumber: string | number, 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})`, }; } const blockParam = typeof blockNumber === 'number' ? '0x' + blockNumber.toString(16) : blockNumber; const result = await this.blockchainService.callRPCMethod( service.id, 'eth_getBalance', [address, blockParam] ); if (result.success && result.data) { const weiBalance = BigInt(result.data); const ethBalance = Number(weiBalance) / 1e18; return { success: true, data: { address, blockNumber: blockParam, balance: ethBalance, balanceWei: weiBalance.toString(), balanceHex: result.data, }, metadata: result.metadata, }; } return result; }

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