Skip to main content
Glama

get_payment_history

Retrieve recent L402 Lightning Network payment records from the current session to track autonomous Bitcoin transactions and API access purchases.

Instructions

List recent L402 payments made during this session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of payments to return
sinceNoISO timestamp to filter payments from

Implementation Reference

  • The handler function 'get_payment_history' which retrieves and returns the payment history as a JSON string.
    async def get_payment_history(
        limit: int = 10,
        since: str | None = None,
        budget_manager: "BudgetManager | None" = None,
    ) -> str:
        """
        List recent L402 payments made during this session.
    
        Args:
            limit: Maximum number of payments to return
            since: ISO timestamp to filter payments from
            budget_manager: Budget manager instance
    
        Returns:
            JSON with list of payments
        """
        if not budget_manager:
            return json.dumps(
                {"success": False, "error": "Budget manager not initialized"}
            )
    
        try:
            # Parse since timestamp if provided
            since_dt = None
            if since:
                try:
                    since_dt = datetime.fromisoformat(since.replace("Z", "+00:00"))
                except ValueError:
                    return json.dumps(
                        {
                            "success": False,
                            "error": f"Invalid timestamp format: {since}. Use ISO format.",
                        }
                    )
    
            # Get payment history
            payments = budget_manager.get_history(limit=limit, since=since_dt)
    
            # Get budget status
            status = budget_manager.get_status()
    
            result = {
                "success": True,
                "payments": [p.to_dict() for p in payments],
                "count": len(payments),
                "total_payments": status["payment_count"],
                "session_summary": {
                    "total_spent": status["spent"],
                    "remaining_budget": status["remaining"],
                    "per_request_limit": status["limits"]["per_request"],
                    "per_session_limit": status["limits"]["per_session"],
                },
            }
    
            if payments:
                result["message"] = (
                    f"Showing {len(payments)} of {status['payment_count']} payments. "
                    f"Total spent: {status['spent']} sats."
                )
            else:
                result["message"] = "No payments recorded in this session."
    
            return json.dumps(result, indent=2)
  • The MCP tool definition and input schema registration for 'get_payment_history'.
    Tool(
        name="get_payment_history",
        description="List recent L402 payments made during this session.",
        inputSchema={
            "type": "object",
            "properties": {
                "limit": {
                    "type": "integer",
                    "description": "Maximum number of payments to return",
                    "default": 10,
                },
                "since": {
                    "type": "string",
                    "description": "ISO timestamp to filter payments from",
                },
            },
        },
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks behavioral details. It doesn't disclose whether this is a read-only operation, if it requires authentication, rate limits, error conditions, or what 'session' means contextually. The phrase 'List recent' implies safe retrieval, but specifics are missing.

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 directly states the tool's function and scope without redundancy. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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 no annotations and no output schema, the description is incomplete for a tool with 2 parameters and multiple siblings. It doesn't explain return values (e.g., payment details format), error handling, or how 'session' interacts with parameters like 'since'. For a payment history tool in a complex L402 context, more guidance is needed.

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%, so parameters 'limit' and 'since' are well-documented in the schema. The description adds no additional parameter semantics beyond implying temporal filtering ('recent', 'during this session'), which aligns with but doesn't expand on the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 tool's purpose with a specific verb ('List') and resource ('L402 payments'), and specifies scope ('recent', 'made during this session'). However, it doesn't explicitly differentiate from sibling tools like 'check_invoice_status' or 'verify_l402_payment' that might also relate to payments.

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 minimal guidance by implying usage for recent session payments, but offers no explicit when-to-use rules, no alternatives among siblings (e.g., vs. 'get_all_balances' for broader data), and no prerequisites or exclusions. This leaves the agent with little context for tool selection.

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