get_user_open_orders
Retrieve all open trading orders for a specific Hyperliquid account to monitor active positions and pending trades.
Instructions
Fetch all open orders for a specific user account.
Parameters:
account_address (str): The Hyperliquid account address (e.g., '0xcd5051944f780a621ee62e39e493c489668acf4d').
ctx (Context): The MCP context object for accessing server state.
Returns:
str: A JSON string containing a list of open orders, each with details such as order ID, symbol, size, price,
and status. Returns a JSON string with an error message if the query fails.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_address | Yes |
Implementation Reference
- main.py:44-62 (handler)The primary handler for the 'get_user_open_orders' MCP tool. Decorated with @mcp.tool() for registration. Includes type hints and comprehensive docstring serving as schema. Executes the core logic by calling info.open_orders(account_address) and serializing the result to JSON, with exception handling.# Tool: Get user open orders @mcp.tool() async def get_user_open_orders(account_address: str, ctx: Context) -> str: """ Fetch all open orders for a specific user account. Parameters: account_address (str): The Hyperliquid account address (e.g., '0xcd5051944f780a621ee62e39e493c489668acf4d'). ctx (Context): The MCP context object for accessing server state. Returns: str: A JSON string containing a list of open orders, each with details such as order ID, symbol, size, price, and status. Returns a JSON string with an error message if the query fails. """ try: open_orders = info.open_orders(account_address) return json.dumps(open_orders) except Exception as e: return json.dumps({"error": f"Failed to fetch user open orders: {str(e)}"})