Skip to main content
Glama
ethancod1ng

Bybit MCP Server

by ethancod1ng

cancel_all_orders

Cancel all active trading orders for a specific symbol or product category on Bybit. Use this tool to clear pending orders and manage your trading positions effectively.

Instructions

Cancel all orders for a symbol or category (⚠️ WARNING: Affects real orders on mainnet)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesProduct type
symbolNoTrading symbol (optional, if not provided cancels all orders in category)

Implementation Reference

  • Dispatches the 'cancel_all_orders' tool call to the BybitClient's cancelAllOrders method with category and optional symbol arguments.
    case 'cancel_all_orders':
      result = await this.client.cancelAllOrders(
        args.category as string,
        args.symbol as string
      );
      break;
  • src/tools.ts:105-123 (registration)
    Registers the 'cancel_all_orders' tool including its name, description, and input schema definition.
    {
      name: 'cancel_all_orders',
      description: 'Cancel all orders for a symbol or category (⚠️ WARNING: Affects real orders on mainnet)',
      inputSchema: {
        type: 'object',
        properties: {
          category: {
            type: 'string',
            enum: ['spot', 'linear', 'inverse', 'option'],
            description: 'Product type'
          },
          symbol: {
            type: 'string',
            description: 'Trading symbol (optional, if not provided cancels all orders in category)'
          }
        },
        required: ['category']
      }
    }
  • Implements the core logic for canceling all orders by calling the Bybit API's cancelAllOrders endpoint, with mainnet warning.
    async cancelAllOrders(category: string, symbol?: string) {
      try {
        if (this.config.environment === 'mainnet') {
          console.error('⚠️  WARNING: Canceling ALL orders on MAINNET!');
        }
    
        const response = await this.client.cancelAllOrders({
          category: category as any,
          symbol: symbol
        });
        return response;
      } catch (error) {
        throw new Error(`Failed to cancel all orders: ${error instanceof Error ? error.message : JSON.stringify(error)}`);
      }
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively warns about the real-world impact ('Affects real orders on mainnet'), indicating a destructive operation. However, it lacks details on permissions, rate limits, or error handling, which would enhance transparency.

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

Conciseness5/5

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

The description is front-loaded with the core action and includes a critical warning in a single, efficient sentence. Every word serves a purpose, with no unnecessary elaboration, making it highly concise and well-structured.

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

Completeness3/5

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

Given the tool's complexity (destructive operation with real-world impact) and lack of annotations or output schema, the description is somewhat incomplete. It covers the main risk but misses details like response format, error conditions, or prerequisites, which are important for safe usage.

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%, so the schema already documents parameters well. The description adds minimal value by mentioning 'symbol or category' but does not provide additional semantics beyond what the schema specifies, such as usage examples or edge cases.

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

Purpose5/5

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

The description clearly states the action ('Cancel all orders') and the target ('for a symbol or category'), making the purpose specific and unambiguous. It directly addresses what the tool does without being tautological or vague.

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

Usage Guidelines4/5

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

The description implies usage context by specifying it affects 'real orders on mainnet,' which helps distinguish it from test environments. However, it does not explicitly mention when to use this tool versus alternatives like 'cancel_order' (a sibling tool), leaving some guidance gaps.

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

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