add_mint
Add a mint URL to your wallet to enable money functionalities via Nostr and Cashu for AI agents.
Instructions
Add a mint to the wallet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mintUrl | Yes | Mint URL to add |
Implementation Reference
- wallet.ts:478-502 (handler)Core handler function in MCPWallet class that adds a new mint URL to the wallet configuration, updates the NDKCashuWallet mints list, republishes wallet and mint list events to Nostr, and saves the updated configuration to disk.async addMint(mintUrl: string): Promise<void> { if (!this.wallet || !this.walletData) throw new Error('Wallet not initialized'); try { // Add mint to wallet if not already present const currentMints = this.wallet.mints || []; if (!currentMints.includes(mintUrl)) { this.wallet.mints = [...currentMints, mintUrl]; this.walletData.mints = this.wallet.mints; // Republish wallet info to Nostr with updated mints await this.wallet.publish(); // Update mint list for nutzap reception await this.publishMintList(); this.saveWallet(); } else { } } catch (error) { console.error('Error adding mint:', error); throw error; } }
- wallet.ts:586-595 (schema)Input schema and metadata for the 'add_mint' tool, defining it takes a required 'mintUrl' string parameter.name: 'add_mint', description: 'Add a mint to the wallet', inputSchema: { type: 'object', properties: { mintUrl: { type: 'string', description: 'Mint URL to add' } }, required: ['mintUrl'] } }
- wallet.ts:690-697 (handler)MCP tool dispatch handler in MCPServer.callTool() that validates input, calls the wallet.addMint() method, and formats the response.case 'add_mint': const { mintUrl: mintToAdd } = args; if (!mintToAdd) { throw new Error('mintUrl is required'); } await this.wallet.addMint(mintToAdd); return { content: [{ type: 'text', text: `Added mint: ${mintToAdd}` }] };
- wallet.ts:528-598 (registration)Tool registration in the ListToolsRequestSchema handler where 'add_mint' is listed among available tools with its schema.this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: 'get_balance', description: 'Get the total wallet balance', inputSchema: { type: 'object', properties: {}, required: [] } }, { name: 'get_mint_balances', description: 'Get balance breakdown per mint', inputSchema: { type: 'object', properties: {}, required: [] } }, { 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'] } }, { name: 'pay', description: 'Pay a Lightning invoice', inputSchema: { type: 'object', properties: { bolt11: { type: 'string', description: 'Lightning invoice to pay' } }, required: ['bolt11'] } }, { name: 'zap', description: 'Send a zap to a user', inputSchema: { type: 'object', properties: { recipient: { type: 'string', description: 'User npub or NIP-05 identifier to zap' }, amount: { type: 'number', description: 'Amount in satoshis' }, comment: { type: 'string', description: 'Optional comment' } }, required: ['recipient', 'amount'] } }, { name: 'add_mint', description: 'Add a mint to the wallet', inputSchema: { type: 'object', properties: { mintUrl: { type: 'string', description: 'Mint URL to add' } }, required: ['mintUrl'] } } ] }; });