Skip to main content
Glama

helius_get_token_account_balance

Retrieve the balance of any Solana token account by providing the token address. Optionally set commitment for data confirmation.

Instructions

Get the balance of a token account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenAddressYes
commitmentNo

Implementation Reference

  • The main handler function for the 'helius_get_token_account_balance' tool. It validates the token address, calls Helius connection.getTokenAccountBalance, and returns the token balance.
    export const getTokenAccountBalanceHandler = async (input: GetTokenAccountBalanceInput): Promise<ToolResultSchema> => {
      const tokenAddressResult = validatePublicKey(input.tokenAddress);
      if (!(tokenAddressResult instanceof PublicKey)) {
        return tokenAddressResult;
      }
      try {
        const tokenBalance = await (helius as any as Helius).connection.getTokenAccountBalance(tokenAddressResult, input.commitment);
        return createSuccessResponse(`Token balance: ${JSON.stringify(tokenBalance.value)}`);
      } catch (error) {
        return createErrorResponse(`Error getting token account balance: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Input type definition for the token account balance tool: requires tokenAddress string, optional commitment.
    export type GetTokenAccountBalanceInput = {
      tokenAddress: string;
      commitment?: "confirmed" | "finalized" | "processed";
    }
  • Output type definition for the token account balance tool: amount, decimals, uiAmount, uiAmountString.
    export type GetTokenAccountBalanceOutput = {
      amount: string;
      decimals: number;
      uiAmount: number;
      uiAmountString: string;
    }
  • src/tools.ts:102-113 (registration)
    Tool registration with name, description, and inputSchema for 'helius_get_token_account_balance'.
    {
      name: "helius_get_token_account_balance",
      description: "Get the balance of a token account",
      inputSchema: {
        type: "object",
        properties: {
          tokenAddress: { type: "string" },
          commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] }
        },
        required: ["tokenAddress"]
      }
    },
  • src/tools.ts:556-556 (registration)
    Handler mapping: maps the tool name 'helius_get_token_account_balance' to the getTokenAccountBalanceHandler function.
    "helius_get_token_account_balance": getTokenAccountBalanceHandler,
Behavior2/5

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

With no annotations, the description carries the full burden of disclosing behavior. It does not mention that this is a read-only operation, nor does it address authentication, rate limits, or other behavioral traits. The agent is left to infer that it is a safe query.

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

Conciseness3/5

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

The description is a single sentence of six words, which is concise but overly terse. It lacks structure and important details, sacrificing completeness for brevity.

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 two parameters, no output schema, and multiple siblings, the description is incomplete. It does not explain what format the balance is returned in, what a 'token account' exactly is, or how to interpret the result. More context is needed for an AI agent to use this tool correctly.

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

Parameters1/5

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

The input schema has 0% coverage for parameter descriptions, and the tool description adds no meaning beyond the parameter names. It does not explain that `tokenAddress` is the address of the token account (not the token mint), nor does it clarify the `commitment` enum values or their impact.

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 verb 'Get' and the resource 'balance of a token account', indicating what the tool does. However, it does not differentiate this tool from siblings like `helius_get_token_supply` or `helius_get_token_accounts`, and does not clarify that it requires a specific token account address.

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 such as `helius_get_token_accounts` or `helius_get_token_supply`. The description lacks any context about appropriate usage scenarios.

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/dcSpark/mcp-server-helius'

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