get_balance
Retrieve the total wallet balance via the MCP Money server, enabling AI agents to access financial data using Nostr and Cashu protocols.
Instructions
Get the total wallet balance
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- wallet.ts:240-250 (handler)Core implementation of get_balance tool logic in MCPWallet class. Retrieves and returns the total wallet balance from this.wallet.balance?.amount or 0 if unavailable.async getBalance(): Promise<number> { if (!this.wallet) throw new Error('Wallet not initialized'); try { const balance = this.wallet.balance?.amount || 0; return balance; } catch (error) { console.error('Error getting balance:', error); return 0; } }
- wallet.ts:608-611 (handler)MCP server callTool handler for 'get_balance' that invokes wallet.getBalance() and returns formatted text response.case 'get_balance': const balance = await this.wallet.getBalance(); return { content: [{ type: 'text', text: `Total balance: ${balance} sats` }] };
- wallet.ts:532-539 (registration)Tool registration in listTools response, defining name, description, and empty input schema for get_balance.name: 'get_balance', description: 'Get the total wallet balance', inputSchema: { type: 'object', properties: {}, required: [] } },
- wallet.ts:534-538 (schema)Input schema definition for get_balance tool (no required parameters).inputSchema: { type: 'object', properties: {}, required: [] }
- wallet.ts:752-754 (helper)CLI handler that calls getBalance() for get_balance command.case 'get_balance': await wallet.getBalance(); break;