get_wallet_balance
Retrieve wallet balance information for Bybit trading accounts, supporting multiple account types including UNIFIED, CONTRACT, SPOT, INVESTMENT, OPTION, and FUND accounts. Specify a coin to get specific balance details or omit to view all holdings.
Instructions
Get wallet balance for a specific account type
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountType | Yes | ||
| coin | No |
Implementation Reference
- src/client.ts:85-95 (handler)The core handler function that executes the tool logic by calling the Bybit API's getWalletBalance method.async getWalletBalance(accountType: string, coin?: string) { try { const response = await this.client.getWalletBalance({ accountType: accountType as any, coin: coin }); return response; } catch (error) { throw new Error(`Failed to get wallet balance: ${error instanceof Error ? error.message : JSON.stringify(error)}`); } }
- src/server.ts:85-90 (handler)MCP server dispatch handler that maps the tool name to the client method call.case 'get_wallet_balance': result = await this.client.getWalletBalance( args.accountType as string, args.coin as string ); break;
- src/tools.ts:60-68 (registration)Tool registration in the tools array exported for MCP server list tools request.{ name: 'get_wallet_balance', description: 'Get wallet balance for a specific account type', inputSchema: { type: 'object', properties: WalletBalanceSchema.shape, required: ['accountType'] } },
- src/types.ts:74-77 (schema)Zod schema defining the input parameters for the get_wallet_balance tool.export const WalletBalanceSchema = z.object({ accountType: z.enum(['UNIFIED', 'CONTRACT', 'SPOT', 'INVESTMENT', 'OPTION', 'FUND']).describe('Account type'), coin: z.string().optional().describe('Coin name (if not provided, returns all coins)') });