Skip to main content
Glama

configure_budget

Set spending limits for Bitcoin Lightning Network payments, controlling maximum satoshis per request and per session to manage autonomous transaction costs.

Instructions

Set spending limits for the session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
per_requestNoMaximum satoshis per individual request
per_sessionNoMaximum total satoshis for the entire session

Implementation Reference

  • The actual implementation of the 'configure_budget' tool, which handles the validation and setting of spending limits via the BudgetManager.
    async def configure_budget(
        per_request: int = 1000,
        per_session: int = 10000,
        budget_manager: "BudgetManager | None" = None,
    ) -> str:
        """
        Set spending limits for the session.
    
        Args:
            per_request: Maximum satoshis per individual request
            per_session: Maximum total satoshis for the entire session
            budget_manager: Budget manager instance
    
        Returns:
            JSON with confirmation of limits set
        """
        if not budget_manager:
            return json.dumps(
                {"success": False, "error": "Budget manager not initialized"}
            )
    
        try:
            # Validate inputs
            if per_request <= 0:
                return json.dumps(
                    {"success": False, "error": "per_request must be positive"}
                )
    
            if per_session <= 0:
                return json.dumps(
                    {"success": False, "error": "per_session must be positive"}
                )
    
            if per_request > per_session:
                return json.dumps(
                    {
                        "success": False,
                        "error": "per_request cannot exceed per_session",
                    }
                )
    
            # Update limits
            limits = budget_manager.configure(
                per_request=per_request,
                per_session=per_session,
            )
    
            # Get current status
            status = budget_manager.get_status()
    
            result = {
                "success": True,
                "limits": {
                    "per_request": limits.per_request,
                    "per_session": limits.per_session,
                },
                "current_status": {
                    "spent": status["spent"],
                    "remaining": status["remaining"],
                    "payment_count": status["payment_count"],
                },
                "message": (
                    f"Budget configured: {limits.per_request} sats per request, "
                    f"{limits.per_session} sats per session. "
                    f"Remaining: {status['remaining']} sats."
                ),
            }
    
            return json.dumps(result, indent=2)
    
        except Exception as e:
            logger.exception("Error configuring budget")
            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 full burden for behavioral disclosure. While 'Set' implies a configuration/mutation action, it doesn't specify whether changes are persistent, reversible, or require specific permissions. It also doesn't mention what happens when limits are exceeded or if there are rate limits on configuration changes.

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 wasted words. It's appropriately sized for a simple configuration tool and gets straight to the point without unnecessary elaboration.

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?

For a budget configuration tool in a payment/transaction system with no annotations and no output schema, the description is inadequate. It doesn't explain the relationship to other payment tools, what units are used (satoshis are only mentioned in schema), whether configuration is persistent, or what happens when limits are reached during payment operations.

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?

Schema description coverage is 100%, with both parameters ('per_request' and 'per_session') clearly documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema, so it meets the baseline for high schema coverage.

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 'Set spending limits for the session' clearly states the verb ('Set') and resource ('spending limits'), with 'for the session' providing useful scope context. However, it doesn't differentiate from sibling tools like 'get_budget_status' or explain how this relates to payment operations in the broader toolset.

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., whether a budget must be configured before making payments), when it should be invoked (e.g., at session start), or how it interacts with sibling payment tools like 'pay_invoice' or 'get_budget_status'.

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