check_balance
Check the USDC balance of your workspace in minor units. Verify available funds before executing agreements or consent receipts.
Instructions
Check workspace USDC balance (minor units, 1 USDC = 1,000,000).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- openterms_mcp_server.py:247-254 (handler)The check_balance handler function. Makes a GET request to /v1/ledger, sums the 'amount' field from all ledger entries, and returns the formatted balance in USDC minor units.
elif name == "check_balance": resp = client.get("/v1/ledger", headers=_headers()) if resp.status_code == 200: data = resp.json() entries = data.get("entries", []) balance = sum(e["amount"] for e in entries) if entries else 0 return f"Balance: {balance:,} USDC minor units (${balance / 1_000_000:.2f} USDC)" return _format_error(resp) - openterms_mcp_server.py:58-62 (schema)The schema/definition for the check_balance tool. It takes no input arguments (empty properties) and returns the USDC balance in minor units.
{ "name": "check_balance", "description": "Check workspace USDC balance (minor units, 1 USDC = 1,000,000).", "inputSchema": {"type": "object", "properties": {}}, }, - openterms_mcp_server.py:489-490 (registration)CLI registration: maps the 'balance' CLI command to handle_tool('check_balance', {}).
elif cmd == "balance": print(handle_tool("check_balance", {})) - openterms_mcp_server.py:445-447 (registration)MCP server registration: all tools including check_balance are listed from the TOOLS array via the list_tools handler.
@server.list_tools() async def list_tools(): return [types.Tool(**t) for t in TOOLS] - openterms_mcp_server.py:5-5 (registration)Module docstring listing check_balance as an MVP1 tool.
MVP1: issue_receipt, verify_receipt, check_balance, get_pricing, list_receipts