Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_historical_balance

Retrieve wallet balance at a specific past block height across multiple blockchains using Grove's MCP Server for Pocket Network.

Instructions

Get balance at a specific block height

Input Schema

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

Implementation Reference

  • Handler logic for executing the get_historical_balance tool: extracts parameters, calls the service method, and returns formatted 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 and tool metadata definition for get_historical_balance.
    {
      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 helper function implementing the historical balance query via eth_getBalance RPC call at a 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;
    }
  • Function that defines and returns the list of multichain tools including get_historical_balance for registration with the MCP server.
    export function registerMultichainHandlers(
      server: Server,
      advancedBlockchain: AdvancedBlockchainService
    ): Tool[] {
      const tools: Tool[] = [
        {
          name: 'compare_balances',
          description: 'Compare native token balance for an address across multiple EVM chains',
          inputSchema: {
            type: 'object',
            properties: {
              address: {
                type: 'string',
                description: 'Address to check',
              },
              blockchains: {
                type: 'array',
                items: { type: 'string' },
                description: 'List of blockchain names (optional, defaults to all EVM chains)',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['address'],
          },
        },
        {
          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'],
          },
        },
        {
          name: 'get_gas_price',
          description: 'Get current gas price for a blockchain',
          inputSchema: {
            type: 'object',
            properties: {
              blockchain: {
                type: 'string',
                description: 'Blockchain name',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet'],
                description: 'Network type (defaults to mainnet)',
              },
            },
            required: ['blockchain'],
          },
        },
      ];
    
      return tools;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action but lacks behavioral details: it doesn't mention required permissions, rate limits, error conditions, or what the return format looks like (e.g., numeric balance, units). For a read operation with no annotation coverage, this is a significant gap.

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 waste. It's front-loaded and appropriately sized for the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is minimally adequate but incomplete. It covers the basic purpose but lacks behavioral context and output details. For a 4-parameter tool with 100% schema coverage, it's passable but could be more informative.

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 parameters. The description adds no additional meaning beyond implying 'blockNumber' is used for historical context, but doesn't clarify syntax or format details. Baseline 3 is appropriate when schema does the heavy lifting.

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 'Get balance at a specific block height' clearly states the verb ('Get') and resource ('balance'), with specificity about the temporal aspect ('at a specific block height'). It distinguishes from siblings like 'get_cosmos_balance' or 'get_solana_balance' by emphasizing historical retrieval, though it doesn't explicitly name alternatives.

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?

No guidance is provided on when to use this tool versus alternatives. The description implies usage for historical queries, but it doesn't specify prerequisites, exclusions, or name sibling tools for comparison (e.g., 'get_cosmos_balance' for current balances).

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