Skip to main content
Glama

create_invoice

Generate a Lightning Network invoice to request Bitcoin payments, specifying amount and optional memo for transaction tracking.

Instructions

Create a Lightning invoice to receive payment. Use get_invoice_status to check if paid.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amount_satsYesAmount in satoshis to request
memoNoDescription/memo for the invoice

Implementation Reference

  • MCP tool request handler for 'create_invoice' in src/index.ts.
    case 'create_invoice': {
      const parsed = CreateInvoiceSchema.parse(args);
      const result = await session.requireClient().createInvoice(parsed.amount_sats, parsed.memo);
      const invoiceResponse: Record<string, unknown> = {
        success: true,
        message: `Invoice created for ${parsed.amount_sats} sats`,
        bolt11: result.bolt11,
        payment_hash: result.paymentHash,
        expires_at: result.expiresAt,
      };
      if (result.rawResponse?.tip) {
        invoiceResponse.tip = result.rawResponse.tip;
      }
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(invoiceResponse, null, 2),
          },
        ],
      };
    }
  • Implementation of the 'createInvoice' method in the LightningFaucetClient class.
    async createInvoice(
      amountSats: number,
      memo?: string
    ): Promise<{
      bolt11: string;
      paymentHash: string;
      expiresAt: string;
      rawResponse: CreateInvoiceResponse;
    }> {
      const data: Record<string, unknown> = {
        amount_sats: amountSats,
      };
    
      if (memo) {
        data.memo = memo;
      }
    
      const result = await this.request<CreateInvoiceResponse>('create_invoice', data);
    
      const bolt11 = result.bolt11 || result.invoice || result.payment_request;
      if (!bolt11) {
        throw new Error('No invoice returned from API');
      }
    
      return {
        bolt11,
        paymentHash: result.payment_hash || '',
        expiresAt: result.expires_at || '',
        rawResponse: result,
      };
    }
  • Zod input schema for the 'create_invoice' tool.
    const CreateInvoiceSchema = z.object({
      amount_sats: z.number().int().min(1).max(10_000_000).describe('Amount in satoshis to request'),
      memo: z.string().max(640).optional().describe('Description/memo for the invoice'),
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool creates an invoice for receiving payment and references checking status, but it lacks details on permissions required, rate limits, whether the invoice is stored or ephemeral, or what happens on failure. For a financial tool with zero annotation coverage, this is a significant gap.

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, front-loaded with the main purpose and followed by a usage tip. Every sentence earns its place by providing essential information without redundancy or fluff, making it highly efficient.

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 tool's complexity (financial transaction), lack of annotations, and no output schema, the description is incomplete. It covers the basic purpose and a follow-up action but misses critical details like return values, error handling, or security considerations. It is minimally adequate but has clear gaps for a tool of this nature.

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 clear descriptions for both parameters ('amount_sats' and 'memo'). The description does not add any additional meaning beyond what the schema provides, such as explaining typical memo formats or constraints. Baseline 3 is appropriate since the schema adequately documents the parameters.

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 ('Create a Lightning invoice') and its purpose ('to receive payment'), which distinguishes it from sibling tools like 'pay_invoice' (which sends payment) and 'get_deposit_invoice' (which retrieves one). It uses precise terminology that aligns with the tool's name and function.

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

Usage Guidelines4/5

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

The description provides clear context by mentioning 'Use get_invoice_status to check if paid,' which implies this tool creates an invoice that can later be monitored. However, it does not explicitly state when to use this versus alternatives like 'get_deposit_invoice' or 'claim_lnurl_withdraw,' nor does it outline any prerequisites or exclusions.

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/lightningfaucet/lightning-wallet-mcp'

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