Skip to main content
Glama

deposit

Generate a Lightning Network invoice (bolt11) to deposit satoshis into Cashu mints, enabling AI agents to receive payments via Nostr.

Instructions

Create a deposit invoice (bolt11) for the specified amount and mint. Returns the invoice immediately for payment. If no mint is specified, all mints will be tried concurrently and the first successful response will be used.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesAmount in satoshis
mintUrlNoMint URL to deposit to (optional - all mints tried concurrently if not provided)

Implementation Reference

  • wallet.ts:550-561 (registration)
    Registration of the 'deposit' tool in the ListTools response, including name, description, and input schema definition.
      name: 'deposit',
      description: 'Create a deposit invoice (bolt11) for the specified amount and mint. Returns the invoice immediately for payment. If no mint is specified, all mints will be tried concurrently and the first successful response will be used.',
      inputSchema: {
        type: 'object',
        properties: {
          amount: { type: 'number', description: 'Amount in satoshis' },
          mintUrl: { type: 'string', description: 'Mint URL to deposit to (optional - all mints tried concurrently if not provided)' }
        },
        required: ['amount']
      }
    },
    {
  • Tool handler in callTool switch statement: validates input, calls wallet.createDepositInvoice, and returns formatted response with invoice details.
    case 'deposit':
      const { amount, mintUrl } = args;
      if (!amount) {
        throw new Error('Amount is required');
      }
      const invoice = await this.wallet.createDepositInvoice(amount, mintUrl);
      return { 
        content: [{ 
          type: 'text', 
          text: `Deposit invoice created. Pay this invoice: ${invoice.bolt11}`
        }],
        invoice: invoice.bolt11,
        amount: invoice.amount,
        mintUrl: invoice.mintUrl,
        depositId: invoice.depositId
      };
  • Core implementation of deposit invoice creation: selects mint, initiates NDKCashuDeposit, generates invoice and unique depositId, sets up event listeners for success/error.
    async createDepositInvoice(amount: number, mintUrl?: string): Promise<{ bolt11: string; amount: number; mintUrl: string; depositId: string }> {
      if (!this.wallet || !this.walletData) throw new Error('Wallet not initialized');
      
      try {
        // If no mint URL provided, use first available mint
        if (!mintUrl) {
          if (!this.walletData.mints || this.walletData.mints.length === 0) {
            throw new Error('No mints configured. Please add a mint first.');
          }
          mintUrl = this.walletData.mints[0];
        }
        
        // Add mint to wallet configuration if not already present
        if (!this.walletData.mints.includes(mintUrl)) {
          this.walletData.mints.push(mintUrl);
          this.wallet.mints = this.walletData.mints;
          this.saveWallet();
        }
        
        const deposit: NDKCashuDeposit = this.wallet.deposit(amount, mintUrl);
        const invoice = await deposit.start();
        
        // Generate unique ID for tracking this deposit
        const depositId = `deposit_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
        
        // Set up background monitoring for this deposit
        deposit.on("success", () => {
          console.log(`✅ Deposit ${depositId} completed successfully`);
          this.saveWallet();
        });
        
        deposit.on("error", (error) => {
          console.error(`❌ Deposit ${depositId} failed:`, error);
        });
        
        return { bolt11: invoice, amount, mintUrl, depositId };
        
      } catch (error) {
        console.error('Error creating deposit invoice:', error);
        throw error;
      }
    }
Behavior3/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 describes key behaviors: the tool returns an invoice immediately, and if no mint is specified, it tries all mints concurrently with the first successful response used. However, it lacks details on error handling, rate limits, or authentication requirements.

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 front-loaded with the core purpose, followed by essential behavioral details in two concise sentences. Every sentence earns its place by adding critical information without redundancy or fluff.

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?

Given the complexity of a financial transaction tool with no annotations and no output schema, the description is moderately complete. It covers the purpose and key behavior but lacks details on return values, error cases, or security implications, which are important for such a tool.

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 schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds minimal value beyond the schema by reinforcing that 'mintUrl' is optional and explaining the concurrent mint behavior, but doesn't provide additional syntax or format details.

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 with specific verbs ('Create a deposit invoice') and resources ('bolt11'), specifying it's for a particular amount and mint. It distinguishes from sibling tools like 'pay' or 'zap' by focusing on invoice creation rather than payment execution.

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 (to generate a payment invoice) and includes an implicit alternative by noting that if no mint is specified, all mints are tried concurrently. However, it doesn't explicitly state when NOT to use it or compare it to alternatives like 'pay' for direct payments.

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/pablof7z/mcp-money'

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