Skip to main content
Glama

get-token-balance

Retrieve token balances for specific blockchain addresses to verify holdings and monitor asset distribution.

Instructions

Get token balance of an address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes
tokenYes

Implementation Reference

  • The execute handler for the get-token-balance tool, which uses wagmi's getBalance to fetch the token balance for a given address and token contract.
    execute: async (args) => {
      const address = args.address as Address
      const token = args.token as Address
      const result = await getBalance(wagmiConfig, { address, token })
      return {
        content: [
          {
            type: "text",
            text: JSONStringify(result),
          },
        ],
      }
    },
  • Zod schema defining the input parameters for the get-token-balance tool: address (string) and token (string).
    parameters: z.object({
      address: z.string(),
      token: z.string(),
    }),
  • Registration of the get-token-balance tool via server.addTool within the registerGetBalanceTools function.
    server.addTool({
      name: "get-token-balance",
      description: "Get token balance of an address",
      parameters: z.object({
        address: z.string(),
        token: z.string(),
      }),
      execute: async (args) => {
        const address = args.address as Address
        const token = args.token as Address
        const result = await getBalance(wagmiConfig, { address, token })
        return {
          content: [
            {
              type: "text",
              text: JSONStringify(result),
            },
          ],
        }
      },
    });
  • Top-level call to registerGetBalanceTools(server) in the main MCP server setup, which includes the get-token-balance tool.
    registerGetBalanceTools(server);
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. It states it's a read operation ('Get'), but doesn't describe what happens on invalid addresses/tokens, whether it requires network connectivity, rate limits, authentication needs, or what format the balance returns. For a tool with zero annotation coverage, this is insufficient behavioral context.

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 without any wasted words. Every word contributes directly to understanding what the tool does. The structure is optimal for such a simple tool.

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?

Given the tool has 2 required parameters with 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'token' means in this context, what format the balance returns, error conditions, or dependencies. For a blockchain balance query tool, this leaves too many unanswered questions for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'address' and 'token' but provides no semantic details about what constitutes valid values (e.g., Ethereum address format, token contract address vs symbol), expected formats, or examples. The description adds minimal value beyond parameter names.

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 target resource ('of an address'), making the purpose immediately understandable. It distinguishes from sibling tools like 'get-native-currency-balance' by specifying token balance rather than native currency. However, it doesn't explicitly mention what type of token or address context (e.g., blockchain, wallet), leaving some ambiguity.

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. It doesn't mention when to choose this over 'get-native-currency-balance' for native currency queries, or when to use 'get-account' for broader account information. There's no context about prerequisites, error conditions, or typical use cases.

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/mcpilot'

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