Skip to main content
Glama
samklein952-hub

Hyperliquid MCP Server

cancel_order

Cancel an open order on Hyperliquid exchange by specifying the market symbol and order ID to manage trading positions.

Instructions

Cancel an open order by order ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesMarket symbol
order_idYesOrder ID to cancel

Implementation Reference

  • Main handler implementation of cancel_order. Calls the Hyperliquid exchange API to cancel an order by symbol and order_id.
    def cancel_order(self, symbol: str, order_id: int) -> dict[str, Any]:
        """Cancel an open order."""
        exchange = self._require_exchange()
        result = exchange.cancel(symbol.upper(), order_id)
        return {"status": "cancelled", "result": result}
  • Dispatch handler that routes the 'cancel_order' tool call to the client method, extracting symbol and order_id from arguments.
    case "cancel_order":
        return client.cancel_order(args["symbol"], args["order_id"])
  • Tool registration for 'cancel_order' with name, description, and input schema defining required parameters (symbol and order_id).
    Tool(
        name="cancel_order",
        description="Cancel an open order by order ID",
        inputSchema={
            "type": "object",
            "properties": {
                "symbol": {"type": "string", "description": "Market symbol"},
                "order_id": {"type": "integer", "description": "Order ID to cancel"},
            },
            "required": ["symbol", "order_id"],
        },
    ),
Behavior2/5

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

With no annotations provided, description fails to disclose error conditions, idempotency, side effects, or what happens to partially filled orders.

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?

Extremely concise at 6 words; single sentence is front-loaded with action verb and contains no redundancy.

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?

Minimal viable description for a simple operation; lacks return value documentation (no output schema) and edge case handling.

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 has 100% coverage with adequate descriptions; tool description adds no additional parameter context beyond repeating 'order ID'.

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?

Clear verb (cancel) and resource (open order by ID), implicitly distinguishes from close_position via 'order' vs 'position' terminology.

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?

No guidance on when to use versus alternatives (e.g., close_position for executed trades) or prerequisites (e.g., checking open orders first).

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/samklein952-hub/hyperliquid-mcp'

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