Skip to main content
Glama

helius_get_balance

Retrieve the current SOL balance for any Solana wallet address using the Helius API.

Instructions

Get the balance of a Solana address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
publicKeyYes
commitmentNo

Implementation Reference

  • The getBalanceHandler function implements the core logic for the 'helius_get_balance' tool. It validates the public key, fetches the balance using the Helius connection, and formats the response.
    export const getBalanceHandler = async (input: GetBalanceInput): Promise<ToolResultSchema> => {
      try {
        // Validate the public key is a valid format
        const publicKey = validatePublicKey(input.publicKey);
        if (!(publicKey instanceof PublicKey)) {
          return publicKey;
        }
    
        // Remove the test mode check since we want to use the mock implementation
        
        const balance = await (helius as any as Helius).connection.getBalance(publicKey, input.commitment);
        return createSuccessResponse(`Balance: ${balance} lamports (${balance / LAMPORTS_PER_SOL} SOL)`);
      } catch (error) {
        return createErrorResponse(`Error getting balance: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • The input schema definition for the 'helius_get_balance' tool, specifying the expected parameters: publicKey (required) and optional commitment level.
    {
      name: "helius_get_balance",
      description: "Get the balance of a Solana address",
      inputSchema: {
        type: "object",
        properties: {
          publicKey: { type: "string" },
          commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] }
        },
        required: ["publicKey"]
      }
    },
  • src/tools.ts:550-550 (registration)
    Registration of the 'helius_get_balance' tool, mapping the tool name to its handler function getBalanceHandler in the handlers dictionary.
    "helius_get_balance": getBalanceHandler,
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Get the balance' implies a read-only operation, it doesn't mention potential rate limits, authentication requirements, network-specific behavior, or what happens with invalid addresses. For a tool with no annotation coverage, this leaves significant behavioral questions unanswered.

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 a single, clear sentence that states exactly what the tool does with zero wasted words. It's appropriately sized for a simple query tool and front-loads the essential information.

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 with an enum), no annotations, and no output schema, the description is insufficient. It doesn't explain parameter meanings, return format (balance units, data type), error conditions, or how it differs from similar sibling tools. The conciseness comes at the cost of necessary contextual information.

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 'publicKey' represents (Solana address format, validation requirements) or what 'commitment' means (blockchain confirmation level, default behavior). The description mentions 'Solana address' which hints at the publicKey purpose but doesn't explain the commitment parameter at all.

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 resource ('balance of a Solana address'), making the purpose immediately understandable. It doesn't specifically differentiate from siblings like 'helius_get_token_account_balance' or 'helius_get_account_info' which might provide similar balance information, but the core functionality is unambiguous.

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 siblings like 'helius_get_account_info' and 'helius_get_token_account_balance' that might return balance information in different contexts, there's no indication of when this specific balance query is preferred or what its limitations are.

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