Skip to main content
Glama

get_invoice_status

Check if a Lightning invoice has been paid by providing the payment hash from invoice creation.

Instructions

Check if a created invoice has been paid. Use the payment_hash from create_invoice.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payment_hashYesPayment hash of the invoice to check

Implementation Reference

  • Zod schema for get_invoice_status input validation, requiring a 'payment_hash' string parameter.
    const GetInvoiceStatusSchema = z.object({
      payment_hash: z.string().describe('Payment hash of the invoice to check'),
    });
  • src/index.ts:367-377 (registration)
    Tool registration in the MCP ListTools handler, defining name, description, and input schema for 'get_invoice_status'.
    {
      name: 'get_invoice_status',
      description: 'Check if a created invoice has been paid. Use the payment_hash from create_invoice.',
      inputSchema: {
        type: 'object',
        properties: {
          payment_hash: { type: 'string', description: 'Payment hash of the invoice to check' },
        },
        required: ['payment_hash'],
      },
    },
  • MCP CallToolRequest handler for 'get_invoice_status' - parses args, calls LightningFaucetClient.getInvoiceStatus(), and formats the response.
    case 'get_invoice_status': {
      const parsed = GetInvoiceStatusSchema.parse(args);
      const result = await session.requireClient().getInvoiceStatus(parsed.payment_hash);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              paid: result.paid,
              amount_sats: result.amountSats,
              settled_at: result.settledAt,
              preimage: result.preimage,
              expired: result.expired,
              new_balance: result.newBalance,
            }, null, 2),
          },
        ],
      };
    }
  • Core implementation of getInvoiceStatus in LightningFaucetClient. Sends API request to 'get_invoice_status' endpoint with payment_hash, determines payment status (paid/settled/expired), and returns the result.
    async getInvoiceStatus(paymentHash: string): Promise<{
      paid: boolean;
      amountSats: number;
      settledAt?: string;
      preimage?: string;
      expired: boolean;
      newBalance?: number;
      rawResponse: InvoiceStatusResponse;
    }> {
      const result = await this.request<InvoiceStatusResponse>('get_invoice_status', {
        payment_hash: paymentHash,
      });
    
      const paid = result.paid || result.settled || result.status === 'settled';
    
      return {
        paid,
        amountSats: result.amount_sats || 0,
        settledAt: result.settled_at,
        preimage: result.preimage,
        expired: result.expired || false,
        newBalance: result.new_balance,
        rawResponse: result,
      };
    }
  • InvoiceStatusResponse interface definition used by get_invoice_status to type the raw API response.
    interface InvoiceStatusResponse extends ApiResponse {
      status?: string;
      paid?: boolean;
      settled?: boolean;
      amount_sats?: number;
      memo?: string;
      expires_at?: string;
      settled_at?: string;
      preimage?: string;
      expired?: boolean;
      new_balance?: number;
    }
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only states 'Check if ... paid' without indicating whether the operation is read-only, has side effects, or any error conditions. This is insufficient for a tool with no annotations.

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?

Two sentences, no wasted words. The purpose is stated first, followed by a clear instruction on how to obtain the input. Every sentence contributes meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description should explain what the tool returns (e.g., a boolean or status). It only says 'Check if ... paid', leaving the return format ambiguous. For a simple tool this is minimally adequate but not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for the single parameter, but the description adds valuable context by specifying that the payment hash comes from create_invoice. This helps an agent understand the parameter's origin, going beyond the schema's generic description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/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: 'Check if a created invoice has been paid.' It includes the specific resource ('invoice status') and verb ('check'), and mentions the required input ('payment_hash from create_invoice'), which helps distinguish it from siblings like create_invoice or decode_invoice.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly tells when to use the tool: after creating an invoice, using the 'payment_hash' from create_invoice. This provides clear context, though it does not elaborate on when not to use it or list alternative tools.

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/lightningfaucet/lightning-wallet-mcp'

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