Skip to main content
Glama
getAlby

Lightning Tools MCP Server

by getAlby

parse_invoice

Extract payment details from BOLT-11 lightning invoices to verify amounts, destinations, and expiration times for Lightning Network transactions.

Instructions

Parse a BOLT-11 lightning invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceYesthe bolt11 invoice

Implementation Reference

  • The async handler function that takes the invoice parameter, parses it using the Invoice class from @getalby/lightning-tools, and returns a structured content response with the JSON-stringified invoice data.
    async (params) => {
      const invoice = new Invoice({ pr: params.invoice });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(invoice, null, 2),
          },
        ],
      };
    }
  • Input schema defined using Zod: requires 'invoice' as a string, described as 'the bolt11 invoice'.
    {
      invoice: z.string().describe("the bolt11 invoice"),
    },
  • The registerParseInvoiceTool function registers the parse_invoice tool with the MCP server, specifying name, description, input schema, and handler function.
    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)
    Invocation of registerParseInvoiceTool during the LightningToolsServer constructor to register the tool with the MCP server instance.
    registerParseInvoiceTool(this._server);
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 but offers minimal information. It states the tool parses an invoice but doesn't describe what parsing entails (e.g., extracting amount, destination, expiry), whether it validates the invoice, what happens with invalid input, or the format of results. For a tool with zero annotation coverage, this leaves critical behavioral traits unspecified.

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 a single, efficient sentence that directly states the tool's purpose without any fluff or redundancy. It is appropriately sized for a simple tool and front-loaded with the core action, making it easy to scan and understand quickly.

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 tool's complexity (parsing a structured data format), lack of annotations, and absence of an output schema, the description is insufficiently complete. It doesn't explain what parsing yields (e.g., decoded fields like amount or payee), handle edge cases (e.g., invalid invoices), or provide context for use with siblings. For a tool with no structured output documentation, the description should compensate more.

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 input schema has 100% description coverage, with the single parameter 'invoice' documented as 'the bolt11 invoice'. The description adds no additional semantic context beyond this (e.g., explaining BOLT-11 format requirements or examples). According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even without param details in the description, which applies here.

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 ('Parse') and the target resource ('a BOLT-11 lightning invoice'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'request_invoice' (which likely creates invoices) or 'fiat_to_sats' (which converts currency), leaving room for potential confusion about when to choose this specific parsing tool.

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 valid invoice string), contrast with siblings (e.g., use 'parse_invoice' to decode an existing invoice vs. 'request_invoice' to generate one), or specify typical contexts (e.g., after receiving a payment request). This lack of usage context could lead to incorrect tool selection.

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

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