Skip to main content
Glama
getAlby

Lightning Tools MCP Server

by getAlby

parse_invoice

Decode BOLT-11 invoices to extract payment details using a Lightning Network-compatible tool, enabling efficient invoice processing and integration with Lightning addresses.

Instructions

Parse a BOLT-11 lightning invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceYesthe bolt11 invoice

Implementation Reference

  • The asynchronous handler function that instantiates an Invoice object from the bolt11 'pr' parameter and returns its pretty-printed JSON as text content.
    async (params) => { const invoice = new Invoice({ pr: params.invoice }); return { content: [ { type: "text", text: JSON.stringify(invoice, null, 2), }, ], }; }
  • Zod input schema defining the 'invoice' parameter as a string.
    { invoice: z.string().describe("the bolt11 invoice"), },
  • The registerParseInvoiceTool function that registers the 'parse_invoice' tool on the MCP server, specifying name, description, input schema, and handler.
    export function registerParseInvoiceTool(server: McpServer) { server.tool( "parse_invoice", "Parse a BOLT-11 lightning invoice", { invoice: z.string().describe("the bolt11 invoice"), }, async (params) => { const invoice = new Invoice({ pr: params.invoice }); return { content: [ { type: "text", text: JSON.stringify(invoice, null, 2), }, ], }; } ); }
  • src/index.ts:30-30 (registration)
    Call to register the parse_invoice tool during server initialization.
    registerParseInvoiceTool(this._server);

Other Tools

Related 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/lightning-tools-mcp-server'

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