get_perp_dexs
Retrieve metadata about perpetual markets on Hyperliquid DEX, including trading pairs and contract details like symbol, tick size, and contract type.
Instructions
Retrieve metadata about perpetual markets available on the Hyperliquid decentralized exchange.
Parameters:
ctx (Context): The MCP context object for accessing server state.
Returns:
str: A JSON string containing metadata about perpetual markets, including a list of trading pairs and their
contract details (e.g., symbol, tick size, contract type). Returns a JSON string with an error message if
the query fails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- main.py:104-122 (handler)The handler function for the 'get_perp_dexs' tool. It is registered via the @mcp.tool() decorator and implements the logic to fetch perpetual DEX metadata using the Hyperliquid SDK's info.meta() method, returning JSON data or an error message.@mcp.tool() async def get_perp_dexs(ctx: Context) -> str: """ Retrieve metadata about perpetual markets available on the Hyperliquid decentralized exchange. Parameters: ctx (Context): The MCP context object for accessing server state. Returns: str: A JSON string containing metadata about perpetual markets, including a list of trading pairs and their contract details (e.g., symbol, tick size, contract type). Returns a JSON string with an error message if the query fails. """ try: data = info.meta() # Use meta() as perp_dexs is not a valid SDK method return json.dumps(data) except Exception as e: return json.dumps({"error": f"Failed to fetch perpetual DEXs: {str(e)}"})