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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool is for 'look up' (implying a read operation), but doesn't clarify if it requires authentication, has rate limits, returns specific error conditions, or what 'details' include. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 with zero waste. It front-loads the core purpose and uses precise terminology ('BOLT-11 invoice', 'payment hash'), making it easy to parse quickly. Every word earns its place.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'details' are returned (e.g., status, amount, timestamps), potential errors, or behavioral aspects like idempotency. For a tool with 2 parameters and no structured output documentation, this leaves critical gaps for an agent.

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 description mentions the two input types ('BOLT-11 invoice or payment hash'), but the input schema already has 100% coverage with clear descriptions for 'payment_hash' and 'invoice'. The description adds minimal value beyond the schema, such as implying these are alternative inputs, but doesn't explain their relationship (e.g., if both can be used together). Baseline 3 is appropriate given high schema coverage.

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 tool's purpose: 'Look up lightning invoice details from a BOLT-11 invoice or payment hash.' It specifies the verb ('look up'), resource ('lightning invoice details'), and input types. However, it doesn't explicitly differentiate from sibling tools like 'get_info' or 'make_invoice', which prevents a perfect score.

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 sibling tools like 'get_info' (which might provide general info) or 'pay_invoice' (which might involve payment actions), nor does it specify prerequisites or exclusions. This leaves the agent with minimal context for 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/nwc-mcp-server'

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