Skip to main content
Glama

get-token-balance

Retrieve ERC-20 token balances for any Ethereum address to monitor holdings or verify transactions.

Instructions

Get token balance of an address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesAddress to get balance for.
tokenYesERC-20 token address to get balance for.

Implementation Reference

  • The handler function that executes the get-token-balance tool logic by calling wagmi's getBalance with the provided address and token.
    execute: async (args) => {
      const result = await getBalance(wagmiConfig, args);
      return {
        content: [
          {
            type: "text",
            text: JSONStringify(result),
          },
        ],
      };
    },
  • Input schema definition using Zod for the get-token-balance tool parameters: address and token addresses.
    parameters: z.object({
      address: Address.describe("Address to get balance for."),
      token: Address.describe("ERC-20 token address to get balance for."),
    }),
  • Direct registration of the get-token-balance tool on the FastMCP server instance, including name, description, schema, and handler.
    server.addTool({
      name: "get-token-balance",
      description: "Get token balance of an address.",
      parameters: z.object({
        address: Address.describe("Address to get balance for."),
        token: Address.describe("ERC-20 token address to get balance for."),
      }),
      execute: async (args) => {
        const result = await getBalance(wagmiConfig, args);
        return {
          content: [
            {
              type: "text",
              text: JSONStringify(result),
            },
          ],
        };
      },
    });
  • Intermediate registration call that invokes the registration of get-token-balance (among get-balance tools).
    registerGetBalanceTools(server, wagmiConfig);
  • src/index.ts:15-15 (registration)
    Top-level registration of all tools, which chains to including the get-token-balance tool.
    registerTools(server, wagmiConfig);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but only states what the tool does, not how it behaves. It doesn't mention whether this is a read-only operation, what network/chain it queries, potential rate limits, error conditions, or what format the balance is returned in.

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 extremely concise at just 6 words, front-loading the core purpose immediately. Every word earns its place with zero wasted text or unnecessary elaboration.

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

Completeness2/5

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

For a tool with 2 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns, how to interpret the balance value, what networks/chains it works with, or any error scenarios - leaving significant gaps for an AI agent to understand proper usage.

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 both parameters adequately. The description doesn't add any additional semantic context beyond what's in the schema - it doesn't clarify what type of addresses are valid, whether the token must be ERC-20, or provide examples.

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 clearly states the action ('Get token balance') and resource ('of an address'), making the purpose immediately understandable. However, it doesn't differentiate from the sibling tool 'get-native-currency-balance' which serves a similar purpose for native currency rather than tokens.

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 provides no guidance on when to use this tool versus alternatives like 'get-native-currency-balance' or 'get-account'. There's no mention of prerequisites, context, or comparison with sibling tools that might provide similar functionality.

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/Xiawpohr/metamask-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server