get_user_order_by_cloid
Fetch order details using client order ID to check status, symbol, size, and price for Hyperliquid trading accounts.
Instructions
Fetch details of a specific order by its client order ID for a user account.
Parameters:
account_address (str): The Hyperliquid account address (e.g., '0xcd5051944f780a621ee62e39e493c489668acf4d').
cloid (str): The client order ID to query.
ctx (Context): The MCP context object for accessing server state.
Returns:
str: A JSON string containing the order details, including symbol, size, price, and status.
Returns a JSON string with an error message if the query fails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_address | Yes | ||
| cloid | Yes |
Input Schema (JSON Schema)
{
"properties": {
"account_address": {
"title": "Account Address",
"type": "string"
},
"cloid": {
"title": "Cloid",
"type": "string"
}
},
"required": [
"account_address",
"cloid"
],
"type": "object"
}
Implementation Reference
- main.py:298-316 (handler)The handler function for the 'get_user_order_by_cloid' tool, decorated with @mcp.tool() for registration. It queries the Hyperliquid info SDK for order details by client order ID (cloid) and returns the result as JSON, with error handling.@mcp.tool() async def get_user_order_by_cloid(account_address: str, cloid: str, ctx: Context) -> str: """ Fetch details of a specific order by its client order ID for a user account. Parameters: account_address (str): The Hyperliquid account address (e.g., '0xcd5051944f780a621ee62e39e493c489668acf4d'). cloid (str): The client order ID to query. ctx (Context): The MCP context object for accessing server state. Returns: str: A JSON string containing the order details, including symbol, size, price, and status. Returns a JSON string with an error message if the query fails. """ try: data = info.query_order_by_cloid(account_address, cloid) return json.dumps(data) except Exception as e: return json.dumps({"error": f"Failed to fetch user order by cloid: {str(e)}"})