Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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; } }
  • 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: [] } },
  • Input schema definition for get_balance tool (no required parameters).
    inputSchema: { type: 'object', properties: {}, required: [] }
  • CLI handler that calls getBalance() for get_balance command.
    case 'get_balance': await wallet.getBalance(); break;

Other Tools

Related 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