Skip to main content
Glama

helius_get_token_account_balance

Retrieve the current balance of a specific token account on the Solana blockchain using the Helius API.

Instructions

Get the balance of a token account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenAddressYes
commitmentNo

Implementation Reference

  • The main handler function that executes the tool: validates the token account address, calls the Helius RPC connection.getTokenAccountBalance method, and returns the formatted balance or error.
    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)}`);
      }
    }
  • The tool definition including name, description, and inputSchema for validation.
    {
      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)
    Registration of the tool name to its handler function in the handlers dictionary.
    "helius_get_token_account_balance": getTokenAccountBalanceHandler,
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Get' implies a read-only operation, the description doesn't mention any behavioral traits like rate limits, authentication requirements, error conditions, or what format the balance is returned in. For a read operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 7 words, front-loading the core purpose without any wasted words. Every word contributes directly to understanding what the tool does, making it efficient and immediately understandable.

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 (one required, one optional with enum values), no annotations, and no output schema, the description is insufficiently complete. It doesn't explain parameter meanings, return format, error conditions, or how it differs from similar sibling tools. The description provides only the most basic functional statement without the contextual information needed for proper tool selection and invocation.

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?

With 0% schema description coverage for both parameters, the description provides no information about what 'tokenAddress' or 'commitment' mean. The description mentions 'token account' which hints at the tokenAddress parameter, but doesn't explain what format it expects or what a token account is. The commitment parameter with its enum values is completely undocumented in the description.

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') and resource ('balance of a token account'), making the purpose immediately understandable. However, it doesn't distinguish this tool from sibling tools like 'helius_get_balance' or 'helius_get_account_info', which might also retrieve balance information for different account types.

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. With many sibling tools that retrieve various types of account information (balance, assets, token accounts), there's no indication of when this specific token account balance retrieval is appropriate versus other balance or account query tools.

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