Skip to main content
Glama

get_budget_status

Check current budget status and spending limits for Bitcoin Lightning Network payments. View available funds and configured thresholds to manage autonomous transaction capabilities.

Instructions

View current budget status and spending limits (read-only). Edit ~/.lightning-enable/config.json to change limits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `get_budget_status` function implements the tool's core logic by querying the budget service and returning its status as a JSON string.
    async def get_budget_status(
        budget_service: "BudgetService | None" = None,
    ) -> str:
        """
        View current budget status and spending limits (read-only).
    
        Returns the complete budget configuration, session state, and BTC price info.
        Configuration is READ-ONLY - edit ~/.lightning-enable/config.json to change limits.
    
        Args:
            budget_service: BudgetService instance for budget tracking
    
        Returns:
            JSON with complete budget status including:
            - configuration: All config settings (tiers, limits, session)
            - session: Current session state (spent, remaining, request count)
            - price: Current BTC/USD price info
            - note: Reminder that config is read-only
        """
        if not budget_service:
            # Try to get the global singleton
            try:
                from ..budget_service import get_budget_service
                budget_service = get_budget_service()
            except Exception as e:
                return json.dumps({
                    "success": False,
                    "error": f"Budget service not initialized: {e}",
                    "hint": "Budget service is initialized on first use. Try making a payment first."
                })
    
        try:
            status = budget_service.get_status()
            return json.dumps({
                "success": True,
                **status,
            }, indent=2)
        except Exception as e:
            logger.exception("Error getting budget status")
            return json.dumps({
                "success": False,
                "error": sanitize_error(str(e))
            })
  • The `get_budget_status` tool is registered in the MCP server's list of available tools.
        name="get_budget_status",
        description=(
            "View current budget status and spending limits (read-only). "
            "Edit ~/.lightning-enable/config.json to change limits."
        ),
        inputSchema={
            "type": "object",
            "properties": {},
        },
    ),
  • The `get_budget_status` tool handler is routed in the server's main tool invocation logic.
    elif name == "get_budget_status":
        result = await get_budget_status(
            budget_service=self.budget_service,
        )

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