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,

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