Skip to main content
Glama

get_open_orders

Retrieve open orders on Bybit based on category, symbol, order ID, or filter. Specify limits to fetch specific order details for trading strategies or monitoring.

Instructions

Get open orders

Args:
    category (str): Category (spot, linear, inverse, etc.)
    symbol (Optional[str]): Symbol (e.g., BTCUSDT)
    orderId (Optional[str]): Order ID
    orderLinkId (Optional[str]): Order link ID
    orderFilter (Optional[str]): Order filter
    limit (int): Number of orders to retrieve

Returns:
    Dict: Open orders

Example:
    get_open_orders("spot", "BTCUSDT", "123456789", "link123", "Order", 10)

Reference:
    https://bybit-exchange.github.io/docs/v5/order/open-order

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory (spot, linear, inverse, etc.)
limitNoNumber of orders to retrieve
orderFilterNoOrder filter
orderIdNoOrder ID
orderLinkIdNoOrder link ID
symbolNoSymbol (e.g., BTCUSDT)

Implementation Reference

  • Primary MCP tool handler for 'get_open_orders'. Defines input schema with Pydantic Field descriptions, executes the tool by delegating to BybitService.get_open_orders, checks retCode, and handles exceptions with error responses.
    @mcp.tool()
    def get_open_orders(
        category: str = Field(description="Category (spot, linear, inverse, etc.)"),
        symbol: Optional[str] = Field(default=None, description="Symbol (e.g., BTCUSDT)"),
        orderId: Optional[str] = Field(default=None, description="Order ID"),
        orderLinkId: Optional[str] = Field(default=None, description="Order link ID"),
        orderFilter: Optional[str] = Field(default=None, description="Order filter"),
        limit: int = Field(default=50, description="Number of orders to retrieve")
    ) -> Dict:
        """
        Get open orders
    
        Args:
            category (str): Category (spot, linear, inverse, etc.)
            symbol (Optional[str]): Symbol (e.g., BTCUSDT)
            orderId (Optional[str]): Order ID
            orderLinkId (Optional[str]): Order link ID
            orderFilter (Optional[str]): Order filter
            limit (int): Number of orders to retrieve
    
        Returns:
            Dict: Open orders
    
        Example:
            get_open_orders("spot", "BTCUSDT", "123456789", "link123", "Order", 10)
    
        Reference:
            https://bybit-exchange.github.io/docs/v5/order/open-order
        """
        try:
            result = bybit_service.get_open_orders(
                category, symbol, orderId, orderLinkId, orderFilter, limit
            )
            if result.get("retCode") != 0:
                logger.error(f"Failed to get open orders: {result.get('retMsg')}")
                return {"error": result.get("retMsg")}
            return result
        except Exception as e:
            logger.error(f"Failed to get open orders: {e}", exc_info=True)
            return {"error": str(e)}
  • Supporting helper method in BybitService class that directly calls the underlying pybit.unified_trading.HTTP client's get_open_orders method to fetch open orders from Bybit API.
    def get_open_orders(self, category: str, symbol: Optional[str] = None,
                        orderId: Optional[str] = None, orderLinkId: Optional[str] = None,
                        orderFilter: Optional[str] = None, limit: int = 50) -> Dict:
        """
        Get open orders
    
        Args:
            category (str): Category (spot, linear, inverse, etc.)
            symbol (Optional[str]): Symbol (e.g., BTCUSDT)
            orderId (Optional[str]): Order ID
            orderLinkId (Optional[str]): Order link ID
            orderFilter (Optional[str]): Order filter
            limit (int): Number of orders to retrieve
    
        Returns:
            Dict: Open orders
        """
        return self.client.get_open_orders(
            category=category,
            symbol=symbol,
            orderId=orderId,
            orderLinkId=orderLinkId,
            orderFilter=orderFilter,
            limit=limit
        )
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but provides minimal information. It states what the tool does but doesn't describe authentication requirements, rate limits, error conditions, pagination behavior (despite having a limit parameter), or what happens when multiple filtering parameters are combined. For a financial API tool with 6 parameters, this is inadequate behavioral transparency.

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

Conciseness3/5

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

The description is reasonably structured with sections for Args, Returns, Example, and Reference, but includes redundant information. The 'Args' section duplicates schema descriptions without adding value, and the example shows all parameters including optional ones without explaining their optional nature. The structure is clear but not optimally efficient.

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

Completeness2/5

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

For a financial API tool with 6 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain the return format beyond 'Dict: Open orders', doesn't describe error handling, authentication requirements, or rate limiting. The reference link is helpful but doesn't compensate for missing behavioral context that should be in the description itself.

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?

The description includes an 'Args' section that lists all parameters, but the schema already has 100% description coverage with identical parameter descriptions. The description adds no additional semantic context beyond what's in the schema - no examples of valid category values, explanation of how orderFilter works, or guidance on parameter combinations. With complete schema coverage, the baseline 3 is appropriate.

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

Purpose4/5

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

The description clearly states the tool's purpose with 'Get open orders' - a specific verb+resource combination. It distinguishes itself from siblings like 'get_order_history' by focusing specifically on open/active orders rather than historical ones. However, it doesn't explicitly contrast with other order-related tools beyond the name difference.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, when this tool is appropriate versus 'get_order_history' or 'cancel_order', or any context about what constitutes an 'open order' in this system. The agent must infer usage from the tool name alone.

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

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

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