Skip to main content
Glama
Habinar

MCP Paradex Server

by Habinar

paradex_cancel_orders

Cancel pending orders to manage trading exposure, adjust strategies, or respond to market changes. Remove specific orders or clear all orders when needed.

Instructions

Cancel pending orders to manage exposure or adjust your trading strategy.

Use this tool when you need to:
- Remove stale limit orders that are no longer desirable
- Quickly reduce market exposure during volatility
- Update your order strategy by removing existing orders
- Clear your order book before implementing a new strategy
- React to changing market conditions by canceling pending orders

Order cancellation is a critical risk management function and allows you
to quickly adapt to changing market conditions.

Example use cases:
- Canceling limit orders when your outlook changes
- Removing all orders during unexpected market volatility
- Canceling a specific order identified by order ID
- Clearing all orders for a specific market
- Removing stale orders before placing new ones

Calling without any parameters will cancel all orders.

Succesful response indicates that orders were queued for cancellation.
Check order status using order id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
order_idNoOrder id (received from create_order)
client_idNoClient id (provided by you on create_order)
market_idNoMarket is the market to cancel orders forALL

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUnique order identifier generated by Paradex
stpYesSelf Trade Prevention mode
sideYesOrder side
sizeYesOrder size
typeYesOrder type
flagsYesOrder flags, allow flag: REDUCE_ONLY
priceYesOrder price. 0 for MARKET orders
marketYesMarket
seq_noYesUnique increasing number that is assigned to this order update and changes on every order update
statusYesOrder status
accountYesParadex Account
client_idYesClient order id provided by the client at order creation
timestampYesOrder signature timestamp
created_atYesOrder creation time
instructionYesExecution instruction for order matching
received_atYesTimestamp in milliseconds when order was received by API service
published_atYesTimestamp in milliseconds when order was sent to the client
cancel_reasonYesReason for order cancellation if it was closed by cancel
trigger_priceYesTrigger price for stop order
avg_fill_priceYesAverage fill price of the order
remaining_sizeYesRemaining size of the order
last_updated_atYesOrder last update time. No changes once status=CLOSED

Implementation Reference

  • The handler function decorated with @server.tool(name="paradex_cancel_orders"). This implements the core logic: authenticates a Paradex client and calls cancel_order, cancel_order_by_client_id, or cancel_all_orders based on provided parameters, returning the OrderState.
    @server.tool(name="paradex_cancel_orders")
    async def cancel_orders(
        order_id: Annotated[
            str, Field(default="", description="Order id (received from create_order)")
        ],
        client_id: Annotated[
            str, Field(default="", description="Client id (provided by you on create_order)")
        ],
        market_id: Annotated[
            str, Field(default="ALL", description="Market is the market to cancel orders for")
        ],
        ctx: Context = None,
    ) -> OrderState:
        """
        Cancel pending orders to manage exposure or adjust your trading strategy.
    
        Use this tool when you need to:
        - Remove stale limit orders that are no longer desirable
        - Quickly reduce market exposure during volatility
        - Update your order strategy by removing existing orders
        - Clear your order book before implementing a new strategy
        - React to changing market conditions by canceling pending orders
    
        Order cancellation is a critical risk management function and allows you
        to quickly adapt to changing market conditions.
    
        Example use cases:
        - Canceling limit orders when your outlook changes
        - Removing all orders during unexpected market volatility
        - Canceling a specific order identified by order ID
        - Clearing all orders for a specific market
        - Removing stale orders before placing new ones
    
        Calling without any parameters will cancel all orders.
    
        Succesful response indicates that orders were queued for cancellation.
        Check order status using order id.
        """
        client = await get_authenticated_paradex_client()
        if order_id:
            response = client.cancel_order(order_id)
        elif client_id:
            response = client.cancel_order_by_client_id(client_id)
        elif market_id:
            response = client.cancel_all_orders(market_id)
        else:
            raise Exception("Either order_id or client_id must be provided.")
        order = OrderState(**response)
        return order
  • Pydantic Field annotations defining the input schema for the paradex_cancel_orders tool, including order_id, client_id, and market_id parameters.
        order_id: Annotated[
            str, Field(default="", description="Order id (received from create_order)")
        ],
        client_id: Annotated[
            str, Field(default="", description="Client id (provided by you on create_order)")
        ],
        market_id: Annotated[
            str, Field(default="ALL", description="Market is the market to cancel orders for")
        ],
        ctx: Context = None,
    ) -> OrderState:
  • The @server.tool decorator registers the cancel_orders function as the MCP tool named 'paradex_cancel_orders'.
    @server.tool(name="paradex_cancel_orders")
  • Uses the helper get_authenticated_paradex_client() to obtain the Paradex client for cancellation operations.
    client = await get_authenticated_paradex_client()
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behaviors: it describes the action as 'critical risk management', notes that calling without parameters cancels all orders, explains successful response indicates orders were 'queued for cancellation', and advises to check order status using order ID. It doesn't mention rate limits or authentication needs, but covers essential operational details.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core purpose and usage guidelines. Some sentences could be more concise (e.g., 'Order cancellation is a critical risk management function...' is slightly redundant with earlier points), but overall it's well-structured with clear sections and minimal waste.

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

Completeness5/5

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

Given the tool's complexity (cancellation operation with parameters), no annotations, and the presence of an output schema (which handles return values), the description is complete. It covers purpose, usage, behavioral traits, parameter hints, and operational follow-up, providing sufficient context for an agent to use the tool effectively without needing to explain return values.

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 baseline is 3. The description adds some value by implying parameter usage (e.g., 'canceling a specific order identified by order ID' hints at order_id, 'clearing all orders for a specific market' hints at market_id), but doesn't provide explicit syntax or format details beyond what the schema already documents for the three parameters.

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 tool's purpose with specific verbs ('cancel pending orders') and resource ('orders'), distinguishing it from siblings like paradex_create_order (which creates orders) and paradex_open_orders (which lists orders). It explicitly mentions managing exposure and adjusting trading strategy, providing clear differentiation.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool through bullet points (e.g., 'remove stale limit orders', 'quickly reduce market exposure', 'update your order strategy'). It distinguishes from alternatives by implying this is for cancellation versus creation or querying, and includes specific use cases like canceling when outlook changes or during volatility.

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/Habinar/mcp-paradex-py'

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