Skip to main content
Glama
unixlamadev-spec

lightningprox-mcp

check_payment

Verify Lightning invoice payment status and retrieve spend tokens for pay-per-request AI model access. Use after generating an invoice to confirm payment completion.

Instructions

Check if a Lightning invoice has been paid and retrieve the spend token. Poll this after generate_invoice until the payment is confirmed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
charge_idYesCharge ID returned by generate_invoice

Implementation Reference

  • The `checkPayment` function performs the HTTP request to verify the payment and fetch the spend token.
    async function checkPayment(chargeId: string): Promise<any> {
      const res = await fetch(`${LIGHTNINGPROX_URL}/v1/tokens`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ charge_id: chargeId, duration_hours: 720 }),
      });
      const data = await res.json() as any;
      return data;
    }
  • The tool definition for `check_payment` including its description and input schema.
    {
      name: "check_payment",
      description:
        "Check if a Lightning invoice has been paid and retrieve the spend token. Poll this after generate_invoice until the payment is confirmed.",
      inputSchema: {
        type: "object",
        properties: {
          charge_id: {
            type: "string",
            description: "Charge ID returned by generate_invoice",
          },
        },
        required: ["charge_id"],
      },
    },
  • src/index.ts:294-326 (registration)
    The request handler in the `server.setRequestHandler` loop for `check_payment` that calls the `checkPayment` function and formats the response.
    case "check_payment": {
      const { charge_id } = args as any;
      const data = await checkPayment(charge_id);
    
      if (data.spend_token) {
        return {
          content: [
            {
              type: "text",
              text: [
                `✅ Payment confirmed!`,
                ``,
                `Your spend token:`,
                data.spend_token,
                ``,
                `Expires: ${data.expires_at || "30 days"}`,
                ``,
                `Use this token in the spend_token field of the chat tool.`,
              ].join("\n"),
            },
          ],
        };
      }
    
      return {
        content: [
          {
            type: "text",
            text: `⏳ Payment not yet confirmed for charge: ${charge_id}\n\nTry again in a few seconds after paying the Lightning invoice.`,
          },
        ],
      };
    }
Behavior3/5

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

With no annotations, the description carries the full burden. It describes the polling behavior and the fact that it retrieves a spend token upon confirmation, which are useful behavioral traits. However, it lacks details on error handling, rate limits, or what happens if the invoice is unpaid, leaving some gaps in transparency.

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 two sentences with zero waste: the first states the core functionality, and the second provides critical usage guidance. It is front-loaded with the main purpose and appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (polling operation), no annotations, and no output schema, the description is mostly complete. It covers purpose, usage, and basic behavior, but lacks details on return values or error cases, which would be helpful for full completeness.

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 the schema already documents the charge_id parameter. The description adds minimal value by referencing 'Charge ID returned by generate_invoice', which reinforces but doesn't significantly expand beyond 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.

Purpose5/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 specific verbs ('check if...has been paid', 'retrieve the spend token') and identifies the resource ('Lightning invoice'). It distinguishes from siblings by referencing generate_invoice and implying a workflow relationship, making it unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides explicit guidance on when to use this tool ('Poll this after generate_invoice until the payment is confirmed'), including a prerequisite (after generate_invoice) and a stopping condition (until payment confirmed). This clearly differentiates it from other tools like get_balance or list_models.

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/unixlamadev-spec/lightningprox-mcp'

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