Skip to main content
Glama

get_positions

Retrieve current trading positions on Bybit exchange to monitor open trades, view position details, and manage portfolio exposure.

Instructions

Get position information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory (spot, linear, inverse, etc.)
symbolNoSymbol (e.g., BTCUSDT)

Implementation Reference

  • Core handler function that makes the Bybit API request to /v5/position/list to retrieve position information.
    async getPositions(category: string, symbol?: string): Promise<BybitResponse<{ list: Position[] }> | { error: string }> { const params: any = { category }; if (symbol) { params.symbol = symbol; } else { // Add settleCoin for linear/inverse when no symbol specified if (category === 'linear') { params.settleCoin = 'USDT'; } else if (category === 'inverse') { params.settleCoin = 'BTC'; } } return this.makeBybitRequest('/v5/position/list', 'GET', params); }
  • MCP tool call handler that delegates to BybitService.getPositions and formats the response.
    case 'get_positions': { const result = await this.bybitService.getPositions(typedArgs.category, typedArgs.symbol); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Input schema and metadata for the get_positions tool, registered in ListTools response.
    { name: 'get_positions', description: 'Get position information', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Category (spot, linear, inverse, etc.)', }, symbol: { type: 'string', description: 'Symbol (e.g., BTCUSDT)', }, }, required: ['category'], }, },
  • TypeScript interface defining the Position object structure used in getPositions response.
    export interface Position { symbol: string; side: string; size: string; avgPrice: string; positionValue: string; tradeMode: number; positionIdx: number; riskId: number; riskLimitValue: string; entryPrice: string; markPrice: string; liqPrice: string; bustPrice: string; positionMM: string; positionIM: string; tpslMode: string; takeProfit: string; stopLoss: string; trailingStop: string; unrealisedPnl: string; cumRealisedPnl: string; sessionAvgPrice: string; sessionUPL: string; leverage: string; autoAddMargin: number; positionStatus: string; adlRankIndicator: number; isReduceOnly: boolean; mmrSysUpdatedTime: string; leverageSysUpdatedTime: string; createdTime: string; updatedTime: string; seq: number; }

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/kondisettyravi/mcp-bybit-node'

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