Skip to main content
Glama
getAlby

Lightning Tools MCP Server

by getAlby

request_invoice

Generate a Lightning Network invoice by specifying recipient address, amount, and optional payment details for Bitcoin transactions.

Instructions

Request an invoice from a lightning address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lightning_addressYesthe recipient's lightning address
amountYesamount in sats
descriptionNo
payer_dataNo

Implementation Reference

  • The handler function that executes the tool: creates a LightningAddress from the input, fetches LNURL data, requests an invoice with the given amount, description, and payer data, then returns the invoice as JSON text content.
    async (params) => {
      const ln = new LightningAddress(params.lightning_address);
    
      // fetch the LNURL data
      await ln.fetch();
    
      const invoice = await ln.requestInvoice({
        satoshi: params.amount,
        comment: params.description || undefined,
        payerdata: params.payer_data || undefined,
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(invoice, null, 2),
          },
        ],
      };
    }
  • Zod schema defining the input parameters: lightning_address (string), amount (number in sats), optional description (string), optional payer_data (object).
    {
      lightning_address: z
        .string()
        .describe("the recipient's lightning address"),
      amount: z.number().describe("amount in sats"),
      description: z
        .string()
        .describe("note, memo or description describing the invoice")
        .nullish(),
      payer_data: z
        .object({})
        .passthrough()
        .describe(
          "metadata to include with the payment such as the payer's name"
        )
        .nullish(),
    },
  • The registerRequestInvoiceTool function that registers the "request_invoice" tool on the MCP server using server.tool with name, description, input schema, and handler.
    export function registerRequestInvoiceTool(server: McpServer) {
      server.tool(
        "request_invoice",
        "Request an invoice from a lightning address",
        {
          lightning_address: z
            .string()
            .describe("the recipient's lightning address"),
          amount: z.number().describe("amount in sats"),
          description: z
            .string()
            .describe("note, memo or description describing the invoice")
            .nullish(),
          payer_data: z
            .object({})
            .passthrough()
            .describe(
              "metadata to include with the payment such as the payer's name"
            )
            .nullish(),
        },
        async (params) => {
          const ln = new LightningAddress(params.lightning_address);
    
          // fetch the LNURL data
          await ln.fetch();
    
          const invoice = await ln.requestInvoice({
            satoshi: params.amount,
            comment: params.description || undefined,
            payerdata: params.payer_data || undefined,
          });
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(invoice, null, 2),
              },
            ],
          };
        }
      );
    }
  • src/index.ts:28-28 (registration)
    Invocation of the registerRequestInvoiceTool function in the main server constructor to add the tool to the MCP server instance.
    registerRequestInvoiceTool(this._server);
Behavior2/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 states the action ('Request an invoice') but doesn't describe what happens after the request (e.g., whether it generates a payment request, returns an invoice string, or triggers a network operation). It also lacks information about permissions, rate limits, or error conditions.

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 that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse.

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 tool with 4 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns (e.g., an invoice string, payment request object, or confirmation), behavioral traits like network effects or error handling, or how it relates to sibling tools. The lack of output schema increases the need for return value explanation.

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 50% (2 of 4 parameters have descriptions). The description doesn't add any parameter-specific information beyond what's in the schema. However, it implies the purpose of the parameters (lightning_address for recipient, amount for invoice value), which aligns with the schema. Baseline 3 is appropriate given the partial 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 clearly states the action ('Request an invoice') and the target ('from a lightning address'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'parse_invoice' (which likely analyzes existing invoices) or 'fiat_to_sats' (which converts currency).

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. There's no mention of prerequisites, when-not-to-use scenarios, or how this differs from sibling tools like 'parse_invoice' (which might handle existing invoices) or 'fiat_to_sats' (which might be a prerequisite for determining the amount).

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/getAlby/lightning-tools-mcp-server'

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