Skip to main content
Glama
ethancod1ng

Bybit MCP Server

by ethancod1ng

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
NameRequiredDescriptionDefault
accountTypeYes
coinNo

Implementation Reference

  • 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)}`); } }
  • 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'] } },
  • 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)') });

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/ethancod1ng/bybit-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server