Skip to main content
Glama

lookup_invoice

Retrieve details for Lightning Network invoices using BOLT-11 strings or payment hashes to verify payment status and transaction information.

Instructions

Look up lightning invoice details from a BOLT-11 invoice or payment hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payment_hashNoThe payment hash of the invoice to look up
invoiceNoThe BOLT 11 invoice to look up

Implementation Reference

  • The handler function for the 'lookup_invoice' tool. It calls client.lookupInvoice with the provided invoice or payment_hash and returns the result as a formatted JSON text content block.
    async (params) => {
      const result = await client.lookupInvoice({
        invoice: params.invoice || undefined,
        payment_hash: params.payment_hash || undefined,
      });
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the 'lookup_invoice' tool using Zod schemas for optional payment_hash and invoice parameters.
    {
      payment_hash: z
        .string()
        .describe("The payment hash of the invoice to look up")
        .nullish(),
      invoice: z.string().describe("The BOLT 11 invoice to look up").nullish(),
    },
  • The server.tool call that registers the 'lookup_invoice' tool, including its name, description, input schema, and handler function.
    server.tool(
      "lookup_invoice",
      "Look up lightning invoice details from a BOLT-11 invoice or payment hash",
      {
        payment_hash: z
          .string()
          .describe("The payment hash of the invoice to look up")
          .nullish(),
        invoice: z.string().describe("The BOLT 11 invoice to look up").nullish(),
      },
      async (params) => {
        const result = await client.lookupInvoice({
          invoice: params.invoice || undefined,
          payment_hash: params.payment_hash || undefined,
        });
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      }
    );
  • Invocation of registerLookupInvoiceTool during MCP server creation to register the 'lookup_invoice' tool.
    registerLookupInvoiceTool(server, client);

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