Skip to main content
Glama

get_balance

Check your CardZero wallet's USDC balance to monitor available funds.

Instructions

Check the current USDC balance of your CardZero wallet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'get_balance' tool. Calls the CardZero API GET /wallets/{walletId}/balance endpoint and returns the USDC balance as formatted JSON.
      async () => {
        try {
          const missing = requireWalletId();
          if (missing) return errorResponse("Balance check failed", missing);
          const res = await callApi("GET", `/wallets/${WALLET_ID}/balance`);
          if (!res.ok) return errorResponse("Balance check failed", res);
          return successResponse(res.json);
        } catch (e) {
          return { content: [{ type: "text" as const, text: `Balance check error: ${e}` }], isError: true };
        }
      },
    );
  • src/index.ts:117-132 (registration)
    Registration of the 'get_balance' tool on the MCP server using server.tool() with description 'Check the current USDC balance of your CardZero wallet.' and no input schema (empty object).
    server.tool(
      "get_balance",
      "Check the current USDC balance of your CardZero wallet.",
      {},
      async () => {
        try {
          const missing = requireWalletId();
          if (missing) return errorResponse("Balance check failed", missing);
          const res = await callApi("GET", `/wallets/${WALLET_ID}/balance`);
          if (!res.ok) return errorResponse("Balance check failed", res);
          return successResponse(res.json);
        } catch (e) {
          return { content: [{ type: "text" as const, text: `Balance check error: ${e}` }], isError: true };
        }
      },
    );
  • Input schema for 'get_balance' - empty object (no parameters required).
    {},
  • requireWalletId helper - returns an error result if CARDZERO_WALLET_ID env var is missing, used by the handler to validate wallet config.
    function requireWalletId(): ApiResult | null {
      if (WALLET_ID) return null;
      return {
        ok: false,
        status: 401,
        json: {
          error: "config_missing",
          message: "CARDZERO_WALLET_ID is not set. Get one at https://cardzero.ai",
        },
      };
    }
  • successResponse helper - wraps data into the MCP content format with JSON stringified output.
    function successResponse(data: unknown) {
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
      };
    }
Behavior3/5

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

The description indicates a read operation but does not disclose any behavioral details beyond that, such as whether it is rate-limited or requires authentication. Since no annotations are provided, the description carries the burden, which is only partially met.

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 sentence that is front-loaded with the verb 'Check', and every word is essential. There is no fluff.

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 no output schema, the description does not explain what the return value looks like (e.g., a number or string). The tool is simple, but the agent might benefit from knowing the output format.

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 zero parameters and 100% schema coverage, the description adds no parameter information, but the baseline for 0 parameters is 4. The description is adequate for a parameterless tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it checks the current USDC balance of the CardZero wallet, using a specific verb and resource. It distinguishes from siblings like create_job or create_wallet, which are clearly different operations.

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?

No explicit guidance on when to use this tool or when not to. It is implied that it is used when the agent needs to check the balance, but no alternatives or exclusions 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/mrocker/cardzero-mcp'

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