lookup_invoice
Retrieve detailed information about a Lightning Network invoice using a BOLT-11 invoice string or payment hash. Facilitates invoice verification and payment tracking within the NWC MCP Server environment.
Instructions
Look up lightning invoice details from a BOLT-11 invoice or payment hash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice | No | The BOLT 11 invoice to look up | |
| payment_hash | No | The payment hash of the invoice to look up |
Implementation Reference
- src/tools/lookup_invoice.ts:19-32 (handler)The handler function executes the tool logic by calling the NWC client's lookupInvoice method with the provided invoice or payment_hash parameters and returns the result as a formatted JSON text response.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), }, ], }; }
- src/tools/lookup_invoice.ts:12-18 (schema)Zod schema defining the input parameters for the lookup_invoice tool: optional payment_hash (string) and invoice (BOLT11 string).{ 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(), },
- src/tools/lookup_invoice.ts:9-33 (registration)The server.tool call within registerLookupInvoiceTool that registers the lookup_invoice tool, including name, description, input schema, and handler on the MCP server.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), }, ], }; } );
- src/mcp_server.ts:24-24 (registration)Invocation of the registerLookupInvoiceTool function during MCP server creation to enable the lookup_invoice tool.registerLookupInvoiceTool(server, client);