Skip to main content
Glama

make_invoice

Generate Bitcoin Lightning invoices for receiving payments, specifying amount, expiry time, and payment description.

Instructions

Create a lightning invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesamount in millisats
expiryNoexpiry in seconds
descriptionNonote, memo or description describing the invoice
description_hashNohash of a note, memo or description that is too long to fit within the invoice
metadataNoOptional metadata to include with the payment

Implementation Reference

  • The handler function that creates a Lightning invoice using the NWC client and returns the result as formatted text content.
    async (params) => {
      const result = await client.makeInvoice({
        amount: params.amount,
        description: params.description || undefined,
        description_hash: params.description_hash || undefined,
        expiry: params.expiry || undefined,
        metadata: params.metadata || undefined,
      });
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the make_invoice tool, including amount, expiry, description, etc.
    {
      amount: z.number().describe("amount in millisats"),
      expiry: z.number().describe("expiry in seconds").nullish(),
      description: z
        .string()
        .describe("note, memo or description describing the invoice")
        .nullish(),
      description_hash: z
        .string()
        .describe(
          "hash of a note, memo or description that is too long to fit within the invoice"
        )
        .nullish(),
      metadata: z
        .object({})
        .passthrough()
        .describe("Optional metadata to include with the payment")
        .nullish(),
    },
  • The registerMakeInvoiceTool function that registers the make_invoice tool with the MCP server, including name, description, schema, and handler.
    export function registerMakeInvoiceTool(
      server: McpServer,
      client: nwc.NWCClient
    ) {
      server.tool(
        "make_invoice",
        "Create a lightning invoice",
        {
          amount: z.number().describe("amount in millisats"),
          expiry: z.number().describe("expiry in seconds").nullish(),
          description: z
            .string()
            .describe("note, memo or description describing the invoice")
            .nullish(),
          description_hash: z
            .string()
            .describe(
              "hash of a note, memo or description that is too long to fit within the invoice"
            )
            .nullish(),
          metadata: z
            .object({})
            .passthrough()
            .describe("Optional metadata to include with the payment")
            .nullish(),
        },
        async (params) => {
          const result = await client.makeInvoice({
            amount: params.amount,
            description: params.description || undefined,
            description_hash: params.description_hash || undefined,
            expiry: params.expiry || undefined,
            metadata: params.metadata || undefined,
          });
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        }
      );
    }
  • Call to registerMakeInvoiceTool during MCP server creation, integrating the make_invoice tool.
    registerMakeInvoiceTool(server, client);
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 ('Create') but lacks critical details: it doesn't mention whether this is a read-only or mutating operation (though 'Create' implies mutation), what permissions are required, potential side effects (e.g., generating a payment request), rate limits, or what the output looks like (especially problematic without an output schema).

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 extremely concise ('Create a lightning invoice')—just three words—with zero wasted language. It's front-loaded with the core action and resource, making it efficient for quick understanding, though this brevity contributes to gaps in other dimensions.

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 the complexity (a financial transaction tool with 5 parameters, no annotations, and no output schema), the description is incomplete. It doesn't address behavioral aspects like mutation effects, authentication needs, or output format, nor does it provide usage context. For a tool that creates invoices in a payment system, more detail is warranted to ensure safe and correct use.

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 schema description coverage is 100%, meaning all parameters are documented in the schema itself. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain relationships between parameters like 'description' and 'description_hash'). With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.

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 ('Create') and the resource ('a lightning invoice'), providing a specific verb+resource combination. However, it doesn't differentiate this tool from sibling tools like 'lookup_invoice' or 'pay_invoice', which would require mentioning that this generates new invoices rather than querying or paying existing ones.

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. It doesn't mention prerequisites (e.g., needing a lightning wallet), contrast with sibling tools (e.g., 'lookup_invoice' for querying, 'pay_invoice' for paying), or specify appropriate contexts (e.g., for receiving payments).

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/nwc-mcp-server'

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