Skip to main content
Glama

nostr_zap

Send Bitcoin Lightning payments through Nostr with optional comments and event attachments, automatically creating zap receipts when supported or using standard Lightning addresses.

Instructions

Send a Nostr zap (NIP-57 Lightning payment with optional Nostr event). If the recipient supports NIP-57, a proper zap receipt is created. Otherwise falls back to a regular Lightning address payment. REQUIRES AGENT KEY with Nostr identity set.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesLightning address to zap (user@domain.com)
amount_satsYesAmount in satoshis to zap
recipient_pubkeyNoNostr hex pubkey of recipient (for NIP-57 zap receipt)
contentNoOptional zap comment/message
event_idNoNostr event ID to attach zap to (hex format)
relaysNoNostr relay URLs for zap receipt

Implementation Reference

  • The `nostrZap` method in the `LightningFaucetClient` class handles the core logic for the 'nostr_zap' tool, including preparing the API request parameters and executing it.
    async nostrZap(
      address: string,
      amountSats: number,
      recipientPubkey?: string,
      content?: string,
      eventId?: string,
      relays?: string[]
    ): Promise<{
      amountSats: number;
      feeSats: number;
      paymentHash: string;
      newBalance: number;
      zapType: 'nip57' | 'fallback';
      rawResponse: ApiResponse;
    }> {
      const data: Record<string, unknown> = {
        address,
        amount_sats: amountSats,
      };
      if (recipientPubkey) data.recipient_pubkey = recipientPubkey;
      if (content) data.content = content;
      if (eventId) data.event_id = eventId;
      if (relays) data.relays = relays;
    
      const result = await this.request<ApiResponse & {
        amount_sats?: number;
        fee_sats?: number;
        payment_hash?: string;
        new_balance?: number;
        zap_type?: 'nip57' | 'fallback';
      }>('nostr_zap', data);
    
      return {
        amountSats: result.amount_sats || amountSats,
        feeSats: result.fee_sats || 0,
        paymentHash: result.payment_hash || '',
        newBalance: result.new_balance || 0,
  • src/index.ts:1549-1576 (registration)
    The tool 'nostr_zap' is handled in the `src/index.ts` file within the switch-case block of the CallToolRequestSchema handler, where it calls `session.requireClient().nostrZap(...)`.
    case 'nostr_zap': {
      const parsed = NostrZapSchema.parse(args);
      const result = await session.requireClient().nostrZap(
        parsed.address,
        parsed.amount_sats,
        parsed.recipient_pubkey,
        parsed.content,
        parsed.event_id,
        parsed.relays
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: `Zapped ${parsed.amount_sats} sats to ${parsed.address}` +
                (result.zapType === 'nip57' ? ' (NIP-57 zap receipt created)' : ' (regular payment, recipient does not support NIP-57)'),
              amount_sats: result.amountSats,
              fee_sats: result.feeSats,
              payment_hash: result.paymentHash,
              new_balance: result.newBalance,
              zap_type: result.zapType,
            }, null, 2),
          },
        ],
      };
    }
  • The `NostrZapSchema` Zod object in `src/index.ts` defines the input parameters and validation rules for the 'nostr_zap' tool.
    const NostrZapSchema = z.object({
      address: z.string().regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, 'Invalid Lightning address format')
        .describe('Lightning address to zap (user@domain.com format)'),
      amount_sats: z.number().int().positive().describe('Amount in satoshis to zap'),
      recipient_pubkey: z.string().regex(/^[0-9a-f]{64}$/, 'Must be 64-character hex pubkey').optional()
        .describe('Nostr hex pubkey of the recipient (for NIP-57 zap receipt)'),
      content: z.string().max(500).optional().describe('Optional zap comment/message'),
      event_id: z.string().regex(/^[0-9a-f]{64}$/, 'Must be 64-character hex event ID').optional()
        .describe('Nostr event ID to attach the zap to (hex format)'),
      relays: z.array(z.string().url()).optional().describe('Nostr relay URLs for zap receipt publication'),
    });
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 and does well by disclosing key behavioral traits: it describes the dual behavior (NIP-57 zap receipt vs. fallback payment), mentions a prerequisite (agent key requirement), and implies a mutation (sending payment). However, it lacks details on rate limits, error handling, or response format.

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 appropriately sized with three sentences: the first states the purpose and behavior, the second explains the fallback, and the third notes the prerequisite. Each sentence adds value with zero waste, and it is front-loaded with the core functionality.

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?

Given the complexity (a payment tool with Nostr integration), no annotations, and no output schema, the description is mostly complete: it covers purpose, behavior, and prerequisites. However, it lacks details on return values or error cases, which would be helpful for a mutation tool with financial implications.

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 fully documents all parameters. The description adds no additional parameter semantics beyond what's in the schema, such as explaining interactions between parameters (e.g., how 'recipient_pubkey' relates to 'address'), meeting the baseline score of 3.

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 ('Send a Nostr zap') and resource ('NIP-57 Lightning payment with optional Nostr event'), distinguishing it from sibling tools like 'pay_lightning_address' or 'keysend' by specifying the Nostr integration and fallback behavior.

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 for when to use this tool (for Nostr zaps with fallback to Lightning payments) and mentions a prerequisite ('REQUIRES AGENT KEY with Nostr identity set'), but does not explicitly state when not to use it or name alternatives among siblings.

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