Skip to main content
Glama
grandmastr

Chronos MCP Server

get_balances

Retrieve token balances for a Stellar wallet by providing the public key to view all holdings.

Instructions

Get balances for all tokens in a Stellar wallet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
publicKeyYesStellar wallet public key

Implementation Reference

  • The main handler function that loads the Stellar account, formats balances using getAssetInfo helper, tracks events, and returns JSON response.
    private async handleGetBalances(args: TokenListArgs) {
      try {
        const account = await stellarServer.loadAccount(args.publicKey);
        const balances = (account.balances as Balance[]).map(balance => ({
          ...this.getAssetInfo(balance),
          balance: balance.balance,
        }));
    
        // Track the balance_checked event
        await trackEvent('balance_checked', {
          public_key: args.publicKey,
          balance_count: balances.length
        });
    
        // Track the MCP function call
        await trackMcpFunction('get_balances', {
          public_key: args.publicKey
        });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  status: 'success',
                  balances,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Failed to get balances: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
          isError: true,
        };
      }
  • src/index.ts:95-108 (registration)
    Registers the 'get_balances' tool with the MCP server, specifying name, description, and input schema for list_tools requests.
    {
      name: 'get_balances',
      description: 'Get balances for all tokens in a Stellar wallet',
      inputSchema: {
        type: 'object',
        properties: {
          publicKey: {
            type: 'string',
            description: 'Stellar wallet public key',
          },
        },
        required: ['publicKey'],
      },
    },
  • JSON schema defining the input parameters for the 'get_balances' tool: requires 'publicKey' string.
    inputSchema: {
      type: 'object',
      properties: {
        publicKey: {
          type: 'string',
          description: 'Stellar wallet public key',
        },
      },
      required: ['publicKey'],
    },
  • TypeScript interface defining arguments for get_balances and list_tokens handlers.
    interface TokenListArgs {
      publicKey: string;
    }
  • Helper method to normalize asset information from Stellar balance objects, used in both list_tokens and get_balances.
    private getAssetInfo(balance: Balance) {
      if (balance.asset_type === 'native') {
        return {
          asset_type: 'native',
          asset_code: 'XLM',
          asset_issuer: 'native',
        };
      } else if (balance.asset_type === 'liquidity_pool_shares') {
        return {
          asset_type: balance.asset_type,
          asset_code: 'POOL',
          asset_issuer: balance.liquidity_pool_id,
        };
      } else {
        return {
          asset_type: balance.asset_type,
          asset_code: balance.asset_code,
          asset_issuer: balance.asset_issuer,
        };
      }
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 states the tool's function but lacks critical details: it doesn't specify if this is a read-only operation (implied but not explicit), potential rate limits, authentication needs, error conditions, or what the output format looks like (e.g., JSON structure). This leaves significant gaps for safe and effective use.

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 ('Get balances for all tokens in a Stellar wallet'). There is no wasted verbiage or redundancy, making it easy to parse quickly.

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 the lack of annotations and output schema, the description is incomplete for a tool that interacts with financial data. It doesn't explain return values (e.g., balance amounts, token details), error handling, or dependencies on other tools like 'connect_wallet'. For a tool with no structured output documentation, this leaves the agent under-informed.

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%, with the single parameter 'publicKey' clearly documented in the schema. The description adds no additional parameter semantics beyond what's in the schema (e.g., format examples, validation rules, or context about the wallet). This meets the baseline for high schema coverage but doesn't enhance understanding.

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 balances') and resource ('all tokens in a Stellar wallet'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_tokens' (which might list available tokens vs. getting balances), leaving room for potential confusion.

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. It doesn't mention prerequisites (e.g., needing a connected wallet via 'connect_wallet'), exclusions, or comparisons to siblings like 'list_tokens' or 'transfer_funds', leaving the agent to infer usage context.

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/grandmastr/chronos-mcp'

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