check_balance
View USDC balance and wallet address for configured accounts to monitor cryptocurrency holdings and verify payment readiness.
Instructions
Check the USDC balance and address for the configured wallet.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/wallet.ts:15-66 (handler)The check_balance tool is registered and implemented within registerWalletTools in src/tools/wallet.ts. It uses the clientCache to fetch the wallet balance and address and returns it as a formatted JSON string.
server.tool( 'check_balance', 'Check the USDC balance and address for the configured wallet.', {}, async () => { if (!config.canPay) { return { content: [ { type: 'text' as const, text: 'No wallet configured. Set STELLAR_SECRET or EVM_PRIVATE_KEY, or use create_wallet.' } ], isError: true } } try { const client = await clientCache.getClient(config.network, config) const balance = await client.getBalance() const address = client.getAddress() return { content: [ { type: 'text' as const, text: JSON.stringify( { address, balance: `${balance} USDC`, network: config.network, mode: config.mode }, null, 2 ) } ] } } catch (err) { return { content: [ { type: 'text' as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` } ], isError: true } } } )