Skip to main content
Glama
unixlamadev-spec

lightningprox-mcp

generate_invoice

Create Bitcoin Lightning invoices to add funds to LightningProx spend tokens for pay-per-request AI model access. Specify satoshi amount to generate BOLT11 payment request.

Instructions

Generate a Bitcoin Lightning invoice to top up a LightningProx spend token. Returns a BOLT11 payment request and charge ID. Pay the invoice with any Lightning wallet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amount_satsYesAmount in satoshis to top up (e.g. 5000, 25000, 100000)

Implementation Reference

  • The `generateInvoice` function, which performs the actual API call to LightningProx to generate a BOLT11 invoice and charge ID.
    async function generateInvoice(amountSats: number): Promise<any> {
      const res = await fetch(`${LIGHTNINGPROX_URL}/v1/topup`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ amount_sats: amountSats, duration_hours: 720 }),
      });
      // 402 is expected — it IS the invoice response
      const data = await res.json() as any;
      if (!data.payment_request && !data.charge_id) {
        throw new Error(data.error || `Invoice generation failed: ${res.status}`);
      }
      return data;
    }
  • src/index.ts:76-90 (registration)
    Tool definition for `generate_invoice` within the `tools` array.
    {
      name: "generate_invoice",
      description:
        "Generate a Bitcoin Lightning invoice to top up a LightningProx spend token. Returns a BOLT11 payment request and charge ID. Pay the invoice with any Lightning wallet.",
      inputSchema: {
        type: "object",
        properties: {
          amount_sats: {
            type: "number",
            description: "Amount in satoshis to top up (e.g. 5000, 25000, 100000)",
          },
        },
        required: ["amount_sats"],
      },
    },
  • The `CallToolRequestSchema` handler case for `generate_invoice`, which parses arguments and calls the `generateInvoice` helper function.
    case "generate_invoice": {
      const { amount_sats } = args as any;
      const data = await generateInvoice(amount_sats);
    
      return {
        content: [
          {
            type: "text",
            text: [
              `⚡ Lightning Invoice Generated`,
              ``,
              `Amount: ${data.amount_sats || amount_sats} sats (~$${data.amount_usd || "?"})`,
              ``,
              `Invoice (BOLT11):`,
              data.payment_request,
              ``,
              `Charge ID: ${data.charge_id}`,
              ``,
              `Pay with any Lightning wallet, then use check_payment with the charge_id to get your spend token.`,
              ``,
              `Or pay at: ${LIGHTNINGPROX_URL}/topup`,
            ].join("\n"),
          },
        ],
      };
    }
Behavior3/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 adds some context by stating what the tool returns ('BOLT11 payment request and charge ID') and how to use the output ('Pay the invoice with any Lightning wallet'), but it lacks details on permissions, rate limits, or error handling, which are important for a financial transaction tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the main purpose and efficiently structured in two sentences that provide essential information without waste. However, it could be slightly more concise by integrating the payment instruction more seamlessly, but overall it is well-sized and clear.

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

Completeness3/5

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

Given the complexity of a financial tool with no annotations and no output schema, the description is moderately complete. It covers the purpose and output but lacks details on error cases, authentication needs, or response format. For a tool generating invoices, more contextual information would enhance 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?

The input schema has 100% description coverage, with the parameter 'amount_sats' clearly documented. The description does not add any additional meaning or details beyond what the schema provides, such as constraints or examples not already covered. The baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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 specific action ('Generate a Bitcoin Lightning invoice') and resource ('to top up a LightningProx spend token'), distinguishing it from sibling tools like check_payment or get_balance. It precisely defines the tool's function without being vague or tautological.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning 'top up a LightningProx spend token' and 'Pay the invoice with any Lightning wallet,' but it does not explicitly state when to use this tool versus alternatives like check_payment or get_balance. No exclusions or prerequisites are provided, leaving usage guidance incomplete.

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