get_balance
Retrieve total wallet balance from MCP Money server to monitor cryptocurrency holdings via Nostr and Cashu protocols.
Instructions
Get the total wallet balance
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_balance"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- wallet.ts:240-250 (handler)Core handler function in MCPWallet class that executes the get_balance tool logic by retrieving and returning the total wallet balance in satoshis from the NDKCashuWallet instance.
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:531-539 (registration)Registration of the get_balance tool in the MCP server's listTools handler, defining its name, description, and input schema (no required parameters).
{ name: 'get_balance', description: 'Get the total wallet balance', inputSchema: { type: 'object', properties: {}, required: [] } }, - wallet.ts:608-611 (handler)MCP tool dispatch handler in MCPServer.callTool method that handles 'get_balance' calls by invoking the wallet's getBalance() and formatting the MCP response.
case 'get_balance': const balance = await this.wallet.getBalance(); return { content: [{ type: 'text', text: `Total balance: ${balance} sats` }] }; - wallet.ts:752-754 (registration)CLI command registration for 'get_balance' in the main function's switch statement, which calls the wallet handler.
case 'get_balance': await wallet.getBalance(); break; - wallet.ts:801-801 (helper)Help text description for the get_balance command in CLI usage.
console.log(' get_balance - Get total wallet balance');