Skip to main content
Glama

get_stacks_account_info

Retrieve Stacks blockchain account details including balance, transaction history, and token holdings to monitor wallet activity and verify account status.

Instructions

Get comprehensive information about a Stacks account including STX balance, nonce, tokens, and recent activity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesStacks address (e.g., SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R)
includeTokensNoInclude token balances in response
includeTransactionsNoInclude recent transactions in response

Implementation Reference

  • Full implementation of the get_stacks_account_info tool handler, including execute function that fetches and formats Stacks account information.
    export const getStacksAccountInfoTool: Tool<undefined, typeof AccountInfoScheme> = {
      name: "get_stacks_account_info",
      description: "Get comprehensive information about a Stacks account including STX balance, nonce, tokens, and recent activity.",
      parameters: AccountInfoScheme,
      execute: async (args, context) => {
        try {
          await recordTelemetry({ action: "get_stacks_account_info" }, context);
          
          const apiService = new StacksApiService();
          const network = (process.env.STACKS_NETWORK as "mainnet" | "testnet" | "devnet") || "mainnet";
          const accountInfo = await apiService.getAccountInfo(args.address, network);
          
          let response = `# Stacks Account Information
    
    ## Address: ${args.address}
    
    ### STX Balance
    - **Total STX**: ${(parseInt(accountInfo.balance) / 1000000).toLocaleString()} STX
    - **Available STX**: ${(parseInt(accountInfo.balance) / 1000000).toLocaleString()} STX
    - **Locked STX**: ${(parseInt(accountInfo.locked) / 1000000).toLocaleString()} STX
    
    ### Account Details
    - **Account Nonce**: ${accountInfo.nonce}
    - **Account Status**: Active
    
    ### Network Information
    - **Network**: ${process.env.STACKS_NETWORK || 'mainnet'}
    - **API Endpoint**: ${process.env.STACKS_API_URL || 'https://api.stacks.co'}`;
    
          // Add token information if requested
          if (args.includeTokens) {
            try {
              const balanceData = await apiService.getAccountBalance(args.address, network);
              
              if (balanceData && balanceData.fungible_tokens) {
                response += `\n\n### Token Balances\n`;
                Object.entries(balanceData.fungible_tokens).forEach(([tokenId, tokenData]: [string, any]) => {
                  response += `- **${tokenId}**: ${tokenData.balance}\n`;
                });
              } else {
                response += `\n\n### Token Balances\nNo token balances found.`;
              }
            } catch (error) {
              response += `\n\n### Token Balances\n⚠️ Could not retrieve token balances: ${error}`;
            }
          }
    
          // Add transaction history if requested
          if (args.includeTransactions) {
            try {
              const txData = await apiService.getAccountTransactions(args.address, network, 10);
              const transactions = txData.results || [];
              
              if (transactions && transactions.length > 0) {
                response += `\n\n### Recent Transactions (Last 10)\n`;
                transactions.forEach((tx: any, index: number) => {
                  response += `${index + 1}. **${tx.tx_type}** - ${tx.tx_status} (Block: ${tx.block_height || 'Pending'})\n`;
                  response += `   - TX ID: ${tx.tx_id}\n`;
                  response += `   - Fee: ${(parseInt(tx.fee_rate || '0') / 1000000).toFixed(6)} STX\n\n`;
                });
              } else {
                response += `\n\n### Recent Transactions\nNo recent transactions found.`;
              }
            } catch (error) {
              response += `\n\n### Recent Transactions\n⚠️ Could not retrieve transactions: ${error}`;
            }
          }
    
          response += `\n\n## Useful Tools
    - Use \`check_stx_balance\` for simple STX balance checks
    - Use \`get_transaction_history\` for detailed transaction analysis
    - Use \`validate_stacks_address\` to verify address format
    - Use \`get_sip010_balance\` for specific token balance checks`;
    
          return response;
          
        } catch (error) {
          return `❌ Failed to get account information: ${error}`;
        }
      },
    };
  • Zod input schema for the tool defining address and optional flags for tokens and transactions.
    const AccountInfoScheme = z.object({
      address: z.string().describe("Stacks address (e.g., SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R)"),
      includeTokens: z.boolean().optional().describe("Include token balances in response"),
      includeTransactions: z.boolean().optional().describe("Include recent transactions in response"),
    });
  • Registration of the getStacksAccountInfoTool with the FastMCP server.
    server.addTool(getStacksAccountInfoTool);
  • Import statement that brings the getStacksAccountInfoTool into the index for registration.
    import {
      getStacksAccountInfoTool,
      checkSTXBalanceTool,
      getTransactionHistoryTool,
      validateStacksAddressTool
    } from "./stacks_blockchain/accounts/stacks_account.js";
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks behavioral details. It doesn't disclose whether this is a read-only operation, requires authentication, has rate limits, returns paginated results, or what format 'recent activity' includes. The description is functional but misses key operational context.

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, efficient sentence that front-loads the core purpose and enumerates key data points without unnecessary words. Every element serves a clear purpose in communicating the tool's scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 3 parameters, 100% schema coverage, and no output schema, the description is minimally adequate. It covers what data is retrieved but lacks context about behavioral traits, response format, or error conditions. Given the absence of annotations and output schema, more operational guidance would be beneficial.

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 parameters are well-documented in the schema. The description adds marginal value by mentioning 'tokens' and 'recent activity' which map to the optional boolean parameters, but doesn't provide additional semantic context beyond what the schema already specifies.

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 ('Get') and resource ('Stacks account'), listing key information retrieved (STX balance, nonce, tokens, recent activity). It distinguishes from sibling tools like 'check_stx_balance' by offering comprehensive data, though it doesn't explicitly name alternatives.

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 when comprehensive account information is needed, but provides no explicit guidance on when to use this tool versus alternatives like 'check_stx_balance' or 'get_transaction_history'. No prerequisites, exclusions, or comparative context are mentioned.

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