Skip to main content
Glama
t3rmed

Hyperliquid MCP Server

by t3rmed

get_all_mids

Retrieve current mid prices for all cryptocurrencies available on the Hyperliquid decentralized exchange to access real-time market data.

Instructions

Get current mid prices for all coins on Hyperliquid

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'get_all_mids' that invokes the Hyperliquid client method and formats the response as MCP TextContent.
    async def handle_get_all_mids(client: HyperliquidClient, args: Dict[str, Any]) -> Dict[str, Any]:
        """Handle get all mids request."""
        result = await client.get_all_mids()
    
        if not result.success:
            raise ValueError(f"Failed to get mid prices: {result.error}")
    
        return {
            "content": [
                TextContent(
                    type="text",
                    text=f"Mid prices for all coins:\n{json.dumps(result.data, indent=2)}",
                )
            ]
        }
  • Tool schema definition (MCP Tool object) for 'get_all_mids', specifying no input parameters.
    get_all_mids_tool = Tool(
        name="get_all_mids",
        description="Get current mid prices for all coins on Hyperliquid",
        inputSchema={
            "type": "object",
            "properties": {},
            "required": [],
        },
    )
  • HyperliquidClient helper method implementing the core API call to fetch all mid prices via POST /info.
    async def get_all_mids(self) -> ApiResponse[AllMidsResponse]:
        """Get current mid prices for all coins."""
        try:
            response = await self.client.post("/info", json={"type": "allMids"})
            response.raise_for_status()
            return ApiResponse(success=True, data=response.json())
        except Exception as e:
            return ApiResponse(success=False, error=str(e))
  • Registration of the 'get_all_mids' tool schema in the MCP server's list_tools() method.
    @app.list_tools()
    async def list_tools() -> list:
        """List all available tools."""
        return [
            # Market data tools
            get_all_mids_tool,
            get_l2_book_tool,
            get_candle_snapshot_tool,
            # Account info tools
            get_open_orders_tool,
            get_user_fills_tool,
            get_user_fills_by_time_tool,
            get_portfolio_tool,
            # Trading tools
            place_order_tool,
            place_trigger_order_tool,
            cancel_order_tool,
            cancel_all_orders_tool,
        ]
  • Dispatch/handling registration in the MCP server's call_tool() method for 'get_all_mids'.
    if name == "get_all_mids":
        result = await handle_get_all_mids(client, args)
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but lacks critical details such as whether it's a read-only operation, potential rate limits, authentication requirements, or what format the mid prices are returned in (e.g., JSON, array).

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?

The description is a single, efficient sentence that front-loads the core action ('Get current mid prices') and resource ('all coins on Hyperliquid'). There is no wasted verbiage, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of retrieving financial data and the absence of annotations and output schema, the description is insufficient. It doesn't explain return values, error handling, or behavioral traits like whether it's real-time or cached data, leaving significant gaps for agent usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description adds value by specifying 'all coins on Hyperliquid', which clarifies scope beyond what the empty schema indicates, earning a baseline 4 for zero-parameter tools.

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?

The description clearly states the verb ('Get') and resource ('current mid prices for all coins on Hyperliquid'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from siblings like 'get_candle_snapshot' or 'get_l2_book', which also retrieve market data but for different metrics.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, timing considerations, or compare it to sibling tools like 'get_portfolio' or 'get_user_fills', leaving the agent to infer usage context.

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

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