Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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: [] } },
  • 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;
  • Help text description for the get_balance command in CLI usage.
    console.log(' get_balance - Get total wallet balance');

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