get_perp_metadata
Fetch metadata for perpetual markets on Hyperliquid exchange, including trading pairs and contract details like symbol and tick size.
Instructions
Fetch metadata about perpetual markets on the Hyperliquid exchange.
Parameters:
include_asset_ctxs (bool, optional): If True, includes asset contexts with metadata. Defaults to False.
ctx (Context, optional): The MCP context object for accessing server state.
Returns:
str: A JSON string containing metadata about perpetual markets, including trading pairs and contract details
(e.g., symbol, tick size). Returns a JSON string with an error message if the query fails.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_asset_ctxs | No |
Implementation Reference
- main.py:340-356 (handler)The handler function that implements the get_perp_metadata tool. It fetches perpetual market metadata from the Hyperliquid Info SDK (using meta() or meta_and_asset_ctxs() based on the parameter), converts it to JSON, and handles exceptions.async def get_perp_metadata(include_asset_ctxs: bool=False, ctx: Context=None) -> str: """ Fetch metadata about perpetual markets on the Hyperliquid exchange. Parameters: include_asset_ctxs (bool, optional): If True, includes asset contexts with metadata. Defaults to False. ctx (Context, optional): The MCP context object for accessing server state. Returns: str: A JSON string containing metadata about perpetual markets, including trading pairs and contract details (e.g., symbol, tick size). Returns a JSON string with an error message if the query fails. """ try: data = info.meta_and_asset_ctxs() if include_asset_ctxs else info.meta() return json.dumps(data) except Exception as e: return json.dumps({"error": f"Failed to fetch perpetual metadata: {str(e)}"})
- main.py:339-339 (registration)The @mcp.tool() decorator that registers the get_perp_metadata function as an MCP tool.@mcp.tool()