get_wallet_balance
Retrieve wallet balance for specified account type and coin on Bybit exchange, enabling precise tracking of cryptocurrency holdings and financial management.
Instructions
Get wallet balance
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountType | Yes | Account type (UNIFIED, CONTRACT, SPOT) | |
| coin | No | Coin symbol |
Implementation Reference
- src/index.ts:769-779 (handler)MCP tool request handler that extracts arguments, calls the Bybit service method, and formats the response as MCP content.case 'get_wallet_balance': { const result = await this.bybitService.getWalletBalance(typedArgs.accountType, typedArgs.coin); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:142-155 (schema)Input schema defining parameters for the get_wallet_balance tool: accountType (required) and optional coin.inputSchema: { type: 'object', properties: { accountType: { type: 'string', description: 'Account type (UNIFIED, CONTRACT, SPOT)', }, coin: { type: 'string', description: 'Coin symbol', }, }, required: ['accountType'], },
- src/index.ts:139-156 (registration)Tool registration object added to the MCP server's tools list, including name, description, and input schema.{ name: 'get_wallet_balance', description: 'Get wallet balance', inputSchema: { type: 'object', properties: { accountType: { type: 'string', description: 'Account type (UNIFIED, CONTRACT, SPOT)', }, coin: { type: 'string', description: 'Coin symbol', }, }, required: ['accountType'], }, },
- src/bybit-service.ts:160-164 (helper)Helper method in BybitService that constructs the API request parameters and calls the Bybit V5 wallet-balance endpoint to fetch the balance data.async getWalletBalance(accountType: string, coin?: string): Promise<BybitResponse<{ list: WalletBalance[] }> | { error: string }> { const params: any = { accountType }; if (coin) params.coin = coin; return this.makeBybitRequest('/v5/account/wallet-balance', 'GET', params); }