Skip to main content
Glama

check_stx_balance

Check the STX token balance for any Stacks blockchain address to verify holdings and monitor account status.

Instructions

Check the STX balance for a Stacks address. Simple and fast balance lookup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesStacks address to check balance for
tokenNoSpecific token contract to check (e.g., SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.token-name)

Implementation Reference

  • The 'execute' function that implements the core logic of the 'check_stx_balance' tool. It handles both STX balance checks and optional fungible token balances using StacksApiService.
      execute: async (args, context) => {
        try {
          await recordTelemetry({ action: "check_stx_balance" }, context);
          
          const apiService = new StacksApiService();
          const network = (process.env.STACKS_NETWORK as "mainnet" | "testnet" | "devnet") || "mainnet";
          
          if (args.token) {
            // Check specific token balance
            const [contractAddress, contractName] = args.token.split('.');
            const balance = await apiService.getFungibleTokenBalance(args.token, args.address, network);
            
            return `# Token Balance
    
    **Address**: ${args.address}
    **Token**: ${args.token}
    **Balance**: ${balance} base units
    
    ## Token Details
    - **Contract**: ${args.token}
    
    Use \`get_sip010_info\` to get more details about this token contract.`;
            
          } else {
            // Check STX balance
            const accountInfo = await apiService.getAccountInfo(args.address, network);
            const stxBalance = parseInt(accountInfo.balance) / 1000000;
            const lockedSTX = parseInt(accountInfo.locked) / 1000000;
            const totalSTX = stxBalance + lockedSTX;
            
            return `# STX Balance
    
    **Address**: ${args.address}
    **Available STX**: ${stxBalance.toLocaleString()} STX
    **Locked STX**: ${lockedSTX.toLocaleString()} STX
    **Total STX**: ${totalSTX.toLocaleString()} STX
    **Account Nonce**: ${accountInfo.nonce}
    
    ${lockedSTX > 0 ? `\n⚠️ **Note**: ${lockedSTX.toLocaleString()} STX is locked (likely in Stacking)` : ''}
    
    Use \`get_stacks_account_info\` with \`includeTokens: true\` to see all token balances.`;
          }
          
        } catch (error) {
          return `❌ Failed to check balance: ${error}`;
        }
      },
  • Zod schema defining the input parameters for the check_stx_balance tool: required 'address' and optional 'token'.
    const BalanceCheckScheme = z.object({
      address: z.string().describe("Stacks address to check balance for"),
      token: z.string().optional().describe("Specific token contract to check (e.g., SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.token-name)"),
    });
  • The line where checkSTXBalanceTool is registered with the MCP server using server.addTool().
    server.addTool(checkSTXBalanceTool);
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. It mentions 'simple and fast' but doesn't cover critical aspects like rate limits, authentication needs, error handling, or what the output looks like (e.g., balance format, units). For a read operation tool, this leaves significant gaps in understanding its behavior.

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 appropriately sized with two concise sentences that are front-loaded with the core purpose and followed by a usage note. Every sentence adds value without redundancy, making it efficient and well-structured.

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 no annotations and no output schema, the description is incomplete for a tool with two parameters. It lacks details on behavioral traits (e.g., performance, errors) and output format, which are crucial for an agent to use it effectively. The high schema coverage doesn't compensate for these gaps in context.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents both parameters ('address' and 'token') thoroughly. The description adds no additional semantic details beyond what's in the schema, such as examples or constraints, resulting in the baseline score of 3.

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 tool's purpose with a specific verb ('check') and resource ('STX balance for a Stacks address'), and distinguishes it from other balance tools like 'get_sip010_balance' by specifying STX. However, it doesn't explicitly differentiate from 'get_stacks_account_info' which might also provide balance information, keeping it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context with 'simple and fast balance lookup,' suggesting it's for quick checks, but it doesn't explicitly state when to use this tool versus alternatives like 'get_stacks_account_info' or 'get_sip010_balance,' nor does it provide exclusions or prerequisites.

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/exponentlabshq/stacks-clarity-mcp'

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