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.
      ],
    }));
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Cancel order' implies a destructive mutation, but it doesn't reveal critical traits: whether cancellation is reversible, what permissions are required, if it affects positions or balances, rate limits, or error conditions. For a mutation tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is overly concise at two words, leading to under-specification rather than efficiency. It lacks front-loaded critical information (e.g., domain, constraints) and doesn't earn its place with useful details. While brief, it fails to communicate essential context, making it ineffective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a destructive mutation tool with 5 parameters, no annotations, and no output schema), the description is incomplete. It doesn't address behavioral aspects, usage context, or output expectations, leaving the agent with insufficient information to invoke the tool correctly in a trading environment.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with all 5 parameters documented in the schema (e.g., 'category', 'symbol', 'orderId'). The description adds no parameter information beyond what the schema provides. According to the rules, with high schema coverage (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Cancel order' is a tautology that restates the tool name without adding specificity. It doesn't clarify what type of order (trading order in a financial context) or distinguish it from siblings like 'place_order' or 'get_open_orders'. The verb 'cancel' is clear, but the resource 'order' lacks context about the domain.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing order), exclusions, or relationships with sibling tools like 'place_order' (for creation) or 'get_open_orders' (for listing). The description offers no contextual cues for appropriate usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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