Skip to main content
Glama
elcukro

bank-mcp

by elcukro

get_balance

Retrieve current account balances including booked and expected amounts from financial institutions. Use this tool to check balances for specific accounts or all linked accounts.

Instructions

Get current account balance(s). Returns closing booked balance and expected balance when available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionIdNo
accountIdNoAccount UID. If omitted, returns balances for all accounts.

Implementation Reference

  • Main handler function that executes the get_balance tool logic. It accepts connectionId and accountId parameters, loads connections, iterates through them and accounts, uses caching, and calls provider.getBalance() for each account.
    export async function getBalance(
      args: z.infer<typeof getBalanceSchema>,
    ): Promise<Balance[]> {
      const config = loadConfig();
    
      const connections = args.connectionId
        ? [getConnection(config, args.connectionId)]
        : getAllConnections(config);
    
      const allBalances: Balance[] = [];
    
      for (const conn of connections) {
        const provider = getProvider(conn.provider);
    
        let accountIds: string[];
        if (args.accountId) {
          accountIds = [args.accountId];
        } else {
          const accounts = await provider.listAccounts(conn.config);
          accountIds = accounts.map((a) => a.uid);
        }
    
        for (const accId of accountIds) {
          const cacheKey = `bal:${conn.id}:${accId}`;
          const cached = cache.get<Balance[]>(cacheKey);
          if (cached) {
            allBalances.push(...cached);
            continue;
          }
    
          const balances = await provider.getBalance(conn.config, accId);
          cache.set(cacheKey, balances, TTL.BALANCES);
          allBalances.push(...balances);
        }
      }
    
      return allBalances;
    }
  • Zod schema defining input validation for the get_balance tool. Accepts optional connectionId and accountId parameters, where accountId defaults to returning balances for all accounts if omitted.
    export const getBalanceSchema = z.object({
      connectionId: z.string().optional(),
      accountId: z.string().optional().describe("Account UID. If omitted, returns balances for all accounts."),
    });
  • src/server.ts:44-48 (registration)
    Tool registration in the TOOLS array, defining the tool name 'get_balance', description, and input schema reference.
      name: "get_balance",
      description:
        "Get current account balance(s). Returns closing booked balance and expected balance when available.",
      inputSchema: z.toJSONSchema(getBalanceSchema),
    },
  • src/server.ts:65-65 (registration)
    Handler mapping that connects the 'get_balance' tool name to the getBalance function with schema parsing.
    get_balance: (args) => getBalance(getBalanceSchema.parse(args)),
  • Type definition for the Balance interface, defining the structure of balance objects returned by the tool including accountId, amount, currency, and type fields.
    export interface Balance {
      accountId: string;
      amount: number;
      currency: string;
      type: string; // "closingBooked" | "expected" | etc.
    }
Behavior3/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 return values (closing booked balance and expected balance) and notes availability conditions ('when available'), which adds useful context beyond basic functionality. However, it doesn't disclose important behavioral aspects like whether this is a real-time query, whether it requires authentication, potential rate limits, or error conditions.

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 perfectly concise with two clear sentences that each earn their place. The first sentence states the core purpose, and the second sentence provides essential details about return values and availability conditions. No wasted words or redundant information.

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 balance retrieval tool with 2 parameters, no annotations, and no output schema, the description provides adequate but incomplete context. It covers the purpose and return values well, but lacks guidance on usage scenarios, behavioral constraints, and doesn't fully compensate for the missing parameter documentation (connectionId remains unexplained). The description is complete enough for basic understanding but leaves gaps for optimal tool selection.

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

Parameters4/5

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

With 50% schema description coverage (only accountId has a description), the description adds significant value by clarifying the tool's scope and return values. While it doesn't explicitly mention the parameters, the phrase 'Get current account balance(s)' implies the accountId parameter's purpose, and the plural 'balance(s)' suggests the tool can handle multiple accounts when accountId is omitted, aligning with the schema's accountId description.

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 ('current account balance(s)'), and specifies what information is returned ('closing booked balance and expected balance when available'). It distinguishes itself from siblings like list_accounts by focusing on balance retrieval rather than account listing. However, it doesn't explicitly differentiate from spending_summary which might also involve balance-related data.

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 for retrieving balance information, but provides no explicit guidance on when to use this tool versus alternatives like list_accounts (for account metadata) or spending_summary (for aggregated spending data). The parameter description in the schema provides some context about account filtering, but the tool description itself lacks when/when-not guidance.

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/elcukro/bank-mcp'

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