Skip to main content
Glama

create_withdraw_link

Generate LNURL-withdraw links for receiving Lightning payments via QR codes. Specify an amount or sweep full wallet balance to facilitate secure fund transfers.

Instructions

Create an LNURL-withdraw link for the operator to receive funds. Opens in browser for QR code scanning with any Lightning wallet. Omit amount_sats to sweep full balance. REQUIRES OPERATOR KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amount_satsNoAmount in sats to withdraw (omit to sweep full balance)

Implementation Reference

  • The handler method in the LightningFaucetClient class that executes the 'create_withdraw_link' tool logic by making an API request.
    async createWithdrawLink(amountSats?: number): Promise<{
      lnurl: string;
      paymentUrl: string;
      qrUrl: string;
      amountSats: number;
      platformFeeSats: number;
      maxRoutingFeeSats: number;
      totalDebitSats: number;
      expiresAt: string;
      rawResponse: ApiResponse;
    }> {
      const params: Record<string, unknown> = {};
      if (amountSats !== undefined) {
        params.amount_sats = amountSats;
      }
    
      const result = await this.request<ApiResponse & {
        lnurl?: string;
        payment_url?: string;
        qr_url?: string;
        amount_sats?: number;
        platform_fee_sats?: number;
        max_routing_fee_sats?: number;
        total_debit_sats?: number;
        expires_at?: string;
      }>('create_withdraw_link', params);
    
      return {
        lnurl: result.lnurl || '',
        paymentUrl: result.payment_url || '',
        qrUrl: result.qr_url || '',
        amountSats: result.amount_sats || 0,
        platformFeeSats: result.platform_fee_sats || 0,
        maxRoutingFeeSats: result.max_routing_fee_sats || 0,
        totalDebitSats: result.total_debit_sats || 0,
        expiresAt: result.expires_at || '',
        rawResponse: result,
      };
    }
  • src/index.ts:1441-1465 (registration)
    The MCP server tool handler implementation for 'create_withdraw_link' which calls the client method.
    case 'create_withdraw_link': {
      const amountSats = args && typeof args === 'object' && 'amount_sats' in args
        ? (args as Record<string, unknown>).amount_sats as number | undefined
        : undefined;
      const result = await session.requireClient().createWithdrawLink(amountSats);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: `Withdraw link created for ${result.amountSats} sats. Open the payment URL in a browser and scan the QR code with your Lightning wallet.`,
              payment_url: result.paymentUrl,
              qr_url: result.qrUrl,
              amount_sats: result.amountSats,
              platform_fee_sats: result.platformFeeSats,
              max_routing_fee_sats: result.maxRoutingFeeSats,
              total_debit_sats: result.totalDebitSats,
              expires_at: result.expiresAt,
              lnurl: result.lnurl,
            }, null, 2),
          },
        ],
      };
    }
Behavior4/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. It effectively describes key behaviors: the link 'Opens in browser for QR code scanning with any Lightning wallet' (user interaction pattern) and 'REQUIRES OPERATOR KEY' (authentication requirement). It doesn't mention rate limits, error conditions, or what happens after creation.

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 extremely efficient - three sentences with zero wasted words. The first sentence states the core purpose, the second explains the user interaction, and the third provides crucial behavioral notes. Every sentence earns its place.

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

Completeness4/5

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

For a single-parameter tool with no annotations and no output schema, the description provides good coverage of purpose, behavior, and usage. It could be more complete by explaining what the tool returns (e.g., a URL or QR code) or mentioning error cases, but given the tool's relative simplicity, it's mostly adequate.

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?

Schema description coverage is 100%, so the schema already fully documents the single parameter. The description adds some semantic context by repeating the 'omit to sweep full balance' behavior, but doesn't provide additional meaning beyond what's in the parameter description. This meets the baseline for high schema coverage.

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 specific action ('Create an LNURL-withdraw link'), the resource ('for the operator'), and the purpose ('to receive funds'). It distinguishes this tool from sibling tools like 'withdraw' by specifying it creates a withdraw link rather than performing a withdrawal directly.

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 provides clear context on when to use this tool ('for the operator to receive funds') and includes a specific usage note ('Omit amount_sats to sweep full balance'). However, it doesn't explicitly state when NOT to use it or mention alternatives among sibling tools like 'withdraw' or 'claim_lnurl_withdraw'.

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