get_mint_balances
Retrieve detailed balance breakdowns by mint for managing digital assets through the MCP Money server.
Instructions
Get balance breakdown per mint
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_mint_balances"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- wallet.ts:252-269 (handler)The primary handler function in MCPWallet class that retrieves mint balances from the NDKCashuWallet instance and returns them as a Map.
async getMintBalances(): Promise<Map<string, number>> { if (!this.wallet) throw new Error('Wallet not initialized'); try { const balances = this.wallet.mintBalances; let total = 0; const balanceMap = new Map<string, number>(); for (const [mintUrl, balance] of Object.entries(balances)) { balanceMap.set(mintUrl, balance); total += balance; } return balanceMap; } catch (error) { console.error('Error getting mint balances:', error); return new Map(); } } - wallet.ts:612-621 (handler)MCP server tool call handler that invokes wallet.getMintBalances() and formats the response as text for MCP protocol.
case 'get_mint_balances': const balances = await this.wallet.getMintBalances(); let balanceText = 'Balance per mint:\n'; let total = 0; for (const [mintUrl, balance] of balances) { balanceText += ` ${mintUrl}: ${balance} sats\n`; total += balance; } balanceText += `Total: ${total} sats`; return { content: [{ type: 'text', text: balanceText }] }; - wallet.ts:540-548 (registration)Registration of the get_mint_balances tool in the static tools list returned by listTools handler.
{ name: 'get_mint_balances', description: 'Get balance breakdown per mint', inputSchema: { type: 'object', properties: {}, required: [] } }, - wallet.ts:543-547 (schema)Input schema for the get_mint_balances tool, defining an empty object with no required properties.
inputSchema: { type: 'object', properties: {}, required: [] }