Skip to main content
Glama

cancel_order

Cancel active trading orders on Bybit exchange by specifying category and symbol. Use order ID or link ID to remove specific pending positions from spot, linear, or inverse markets.

Instructions

Cancel order

Input Schema

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

Implementation Reference

  • Core handler function that executes the cancel order logic by building API parameters and calling the Bybit /v5/order/cancel 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); }
  • Defines the tool schema including name, description, and input validation schema 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'], }, },
  • MCP request handler case that dispatches cancel_order tool calls 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), }, ], }; }
  • src/index.ts:691-692 (registration)
    Registers all tools including cancel_order with the MCP server using setTools.
    ], }));

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