Skip to main content
Glama

Token balance

balance
Read-only

Get an address's token holdings from an indexed EVM token contract's Transfer events, with a flag indicating full history versus net transfers since indexing began.

Instructions

Token balance of an address, derived from the indexed EVM token contract's Transfer events (IVM view; i128 base units, returned as a decimal string). The result carries complete_history. When true the nest was indexed from its configured start_block with no --backfill (the contract's deployment if start_block is the deployment block, which init sets) and the figure is under balance. When false or null it is only the net of transfers since indexed_from and is returned as net_flow_since_indexed_from with a note: a negative figure is then not an error, and it must not be reported as a balance.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "address": "<address>"
    },
    "name": "balance"
  }
}

Input Schema

NameRequiredDescriptionDefault
addressYes

Output Schema

NameRequiredDescriptionDefault
noteNoWhat the figure is, when it is not a balance.
addressNoThe address asked about.
balanceNoThe balance, present only when `complete_history` is true.
indexed_fromNoThe first block indexed.
complete_historyNoWhether the figure is a balance.
net_flow_since_indexed_fromNoThe net of transfers since `indexed_from`, when the history is not complete.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv5.23.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "address": {
      +      "description": "The address asked about."
      +    },
      +    "balance": {
      +      "description": "The balance, present only when `complete_history` is true."
      +    },
      +    "complete_history": {
      +      "description": "Whether the figure is a balance."
      +    },
      +    "indexed_from": {
      +      "description": "The first block indexed."
      +    },
      +    "net_flow_since_indexed_from": {
      +      "description": "The net of transfers since `indexed_from`, when the history is not complete."
      +    },
      +    "note": {
      +      "description": "What the figure is, when it is not a balance."
      +    }
      +  },
      +  "type": "object"
      +}
  2. First observedv5.21.0

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered. The description does add real behavioral context — that results may be partial and carry complete_history, and that a negative figure must not be reported as a balance — but it doesn't explain how the contract under query is selected or what happens for an unindexed address.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core purpose is front-loaded in the first clause, and the complete_history contract follows in a logical order. It is a single dense run-on sentence with stacked parentheticals, which hurts readability but wastes few words.

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

Completeness4/5

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

For a one-parameter read-only tool with an output schema, the definition is largely complete: it covers provenance, units, and the partial-index trap. The remaining gaps are the address input format and how the target contract is chosen.

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 0% for the single `address` parameter, so the description must compensate; it only says 'of an address' and never specifies format (0x-prefixed hex, checksummed vs not) or rejection behavior. It adds unit detail for the result but not for the input.

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?

States a specific verb+resource: the token balance of an address, and names the derivation source (indexed EVM token contract's Transfer events) plus units (i128 base units, decimal string). It does not differentiate itself from siblings such as top_balances or exposure, which keeps it below a 5.

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 explains what the number means but gives no when-to-use guidance, no prerequisites, and no alternative named. An agent is left to infer from 'IVM view' that this is a read of indexed state rather than a live chain query.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.