Skip to main content
Glama

cancel_order

Cancel open orders on Bybit exchange by specifying the category, symbol, and order details. Use this tool to manage trades efficiently and maintain control over active positions.

Instructions

Cancel order

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory (spot, linear, inverse, etc.)
orderFilterNoOrder filter
orderIdNoOrder ID
orderLinkIdNoOrder link ID
symbolYesSymbol (e.g., BTCUSDT)

Implementation Reference

  • The core handler function that constructs the cancel order parameters and makes a POST request to Bybit's /v5/order/cancel API endpoint.
    async cancelOrder( category: string, symbol: string, orderId?: string, orderLinkId?: string, orderFilter?: string ): Promise<BybitResponse<any> | { error: string }> { const params: any = { category, symbol }; if (orderId) params.orderId = orderId; if (orderLinkId) params.orderLinkId = orderLinkId; if (orderFilter) params.orderFilter = orderFilter; return this.makeBybitRequest('/v5/order/cancel', 'POST', params); }
  • JSON schema defining the input parameters and validation for the cancel_order tool.
    name: 'cancel_order', description: 'Cancel order', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Category (spot, linear, inverse, etc.)', }, symbol: { type: 'string', description: 'Symbol (e.g., BTCUSDT)', }, orderId: { type: 'string', description: 'Order ID', }, orderLinkId: { type: 'string', description: 'Order link ID', }, orderFilter: { type: 'string', description: 'Order filter', }, }, required: ['category', 'symbol'], }, },
  • src/index.ts:830-846 (registration)
    MCP tool request handler switch case that dispatches cancel_order requests to the BybitService.cancelOrder method and formats the response.
    case 'cancel_order': { const result = await this.bybitService.cancelOrder( typedArgs.category, typedArgs.symbol, typedArgs.orderId, typedArgs.orderLinkId, typedArgs.orderFilter ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }

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