Skip to main content
Glama

balance

Check available funds on payment providers to verify account balances and monitor financial resources.

Instructions

Check available funds on a payment provider.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
providerNoWhich provider to check. Checks all if omitted.

Implementation Reference

  • The 'balance' tool is defined as an MCP tool using server.tool, and handles both checking a specific provider or all configured providers.
    // Tool: balance
    server.tool(
      "balance",
      "Check available funds on a payment provider.",
      BalanceSchema.shape,
      async (params) => {
        try {
          if (params.provider) {
            const provider = pickProvider(undefined, undefined, params.provider);
            const result = await provider.balance();
            return jsonResult(result);
          }
    
          const results = [];
          for (const [, p] of providers) {
            try {
              results.push(await p.balance());
            } catch (err) {
              results.push({
                provider: p.name,
                currency: p.supportedCurrencies[0] ?? "?",
                available: -1,
                error: formatError(err),
              });
            }
          }
          guardrails.audit({
            timestamp: new Date().toISOString(),
            type: "payment",
            action: "balance",
            tool: "balance",
            status: "executed",
          });
          return jsonResult(results);
        } catch (err) {
          guardrails.audit({
            timestamp: new Date().toISOString(),
            type: "payment",
            action: "balance",
            tool: "balance",
            status: "failed",
            reason: formatError(err),
          });
          return textResult(`Balance check failed: ${formatError(err)}`);
        }
      }
    );
  • Zod schema for the 'balance' tool input validation.
    const BalanceSchema = z.object({
      provider: z.string().optional().describe("Which provider to check. Checks all if omitted."),
    });
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 'Check' implies a read-only operation, the description lacks critical details: whether data is real-time or cached, what format/currency the balance is returned in, error handling for invalid providers, or rate limiting.

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, front-loaded sentence of six words with zero redundancy. It efficiently conveys the core action without filler, making it appropriately sized for quick comprehension.

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?

Given the tool's simplicity (one optional parameter, no nested objects), the description adequately covers the basic invocation pattern. However, lacking an output schema, it omits what the agent/user receives (e.g., balance amount, currency, timestamp), which would be necessary for the agent to handle the response correctly.

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?

With 100% schema description coverage (the 'provider' parameter is fully documented in the schema as optional with default behavior), the description meets the baseline. It references 'payment provider' aligning with the parameter name, but adds no semantic value regarding valid provider formats or examples beyond what the schema already provides.

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 uses a clear verb ('Check') and identifies the specific resource ('available funds on a payment provider'). However, it does not differentiate from the sibling tool 'limits', which could also relate to financial thresholds or quotas, potentially causing selection 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 siblings like 'limits' or 'status'. It fails to mention common workflows such as checking balance before invoking 'charge' or 'pay', and does not note prerequisites like authentication requirements.

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/vrllrv/junto-mcp'

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