Skip to main content
Glama

check_wallet_balance

Check the balance of a connected Lightning Network wallet to monitor available funds for autonomous Bitcoin payments and transactions.

Instructions

Check the connected Lightning wallet balance via NWC.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the check_wallet_balance tool handler.
    async def check_wallet_balance(
        wallet: "NWCWallet | None" = None,
    ) -> str:
        """
        Check the connected Lightning wallet balance via NWC.
    
        Returns:
            JSON with balance information or error message
        """
        if not wallet:
            return json.dumps(
                {"success": False, "error": "Wallet not initialized. Check NWC connection."}
            )
    
        try:
            # Get balance
            balance_sats = await wallet.get_balance()
    
            result = {
                "success": True,
                "balance_sats": balance_sats,
                "balance_btc": balance_sats / 100_000_000,
                "message": f"Wallet balance: {balance_sats:,} sats",
            }
    
            # Try to get additional info
            try:
                info = await wallet.get_info()
                if info:
                    result["wallet_info"] = {
                        "alias": info.get("alias"),
                        "network": info.get("network"),
                        "block_height": info.get("block_height"),
                    }
            except Exception:
                # get_info might not be supported by all wallets
                pass
    
            return json.dumps(result, indent=2)
    
        except Exception as e:
            logger.exception("Error checking wallet balance")
            return json.dumps({"success": False, "error": sanitize_error(str(e))})
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 checks a balance but doesn't describe what 'connected' means, potential errors (e.g., if wallet is disconnected), rate limits, authentication needs, or the return format. This leaves significant gaps for a tool that likely interacts with financial data.

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 with zero waste. It front-loads the key action ('Check') and resource, and every word ('connected Lightning wallet balance via NWC') adds specific value without redundancy. This is optimally concise for a no-parameter tool.

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 complexity of financial tools and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'NWC' is, what the balance includes (e.g., on-chain vs. Lightning), error handling, or return format. For a tool that likely returns critical financial data, this leaves too much unspecified.

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?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, and the baseline for 0 parameters is 4, as it avoids unnecessary details while clearly stating the tool's purpose.

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 ('Check') and resource ('connected Lightning wallet balance'), and specifies the method ('via NWC'). It distinguishes from siblings like 'get_all_balances' by focusing on a specific wallet. However, it doesn't explicitly differentiate from all siblings, such as 'get_budget_status', which might also involve balance-related checks.

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., wallet connection), exclusions, or compare it to siblings like 'get_all_balances' (which might return multiple balances) or 'get_budget_status' (which could involve budget-specific checks). Usage is implied only by the tool name and description.

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/refined-element/lightning-enable-mcp'

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