rgb_decode_lightning_invoice
Decode RGB Lightning invoices to extract payment details and transaction information for RGB asset transfers on the Lightning Network.
Instructions
Decode an RGB Lightning invoice
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice | Yes | The RGB Lightning invoice to decode |
Implementation Reference
- src/server.ts:303-318 (registration)Registers the 'rgb_decode_lightning_invoice' MCP tool with input schema, description, and inline handler function that calls the RGB client wrapper.server.tool( 'rgb_decode_lightning_invoice', 'Decode an RGB Lightning invoice', { invoice: z.string().describe('The RGB Lightning invoice to decode'), }, async ({ invoice }) => { try { const result = await rgbClient.decodeRGBLNInvoice(invoice); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: `Error: ${errorMessage}` }], isError: true }; } } );
- src/server.ts:309-317 (handler)The inline MCP tool handler executing the decoding logic via rgbClient and formatting the response as MCP content.async ({ invoice }) => { try { const result = await rgbClient.decodeRGBLNInvoice(invoice); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: `Error: ${errorMessage}` }], isError: true }; } }
- src/server.ts:306-307 (schema)Zod input schema defining the 'invoice' parameter for the tool.{ invoice: z.string().describe('The RGB Lightning invoice to decode'),
- src/rgb-client.ts:93-95 (helper)Helper wrapper method in RGBApiClientWrapper that proxies the decode call to the underlying RGB API SDK lightning module.async decodeRGBLNInvoice(invoice: string) { return await this.client.lightning.decodeRGBLNInvoice(invoice); }