Skip to main content
Glama
kukapay

hyperliquid-info-mcp

get_l2_snapshot

Fetch Level 2 order book snapshots for cryptocurrency trading pairs to analyze market depth with bid and ask price data.

Instructions

Fetch the Level 2 order book snapshot for a specific coin.

Parameters:
    coin_name (str): The trading symbol (e.g., 'BTC', 'ETH').
    ctx (Context): The MCP context object for accessing server state.

Returns:
    str: A JSON string containing the Level 2 order book snapshot, including bids and asks with prices and sizes.
        Returns a JSON string with an error message if the query fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coin_nameYes

Implementation Reference

  • main.py:172-189 (handler)
    The handler function for the 'get_l2_snapshot' tool. It is decorated with @mcp.tool(), which registers it in the FastMCP server. The function fetches the L2 order book snapshot using the Hyperliquid Info SDK and returns it as a JSON string, with error handling.
    @mcp.tool()
    async def get_l2_snapshot(coin_name: str, ctx: Context) -> str:
        """
        Fetch the Level 2 order book snapshot for a specific coin.
    
        Parameters:
            coin_name (str): The trading symbol (e.g., 'BTC', 'ETH').
            ctx (Context): The MCP context object for accessing server state.
    
        Returns:
            str: A JSON string containing the Level 2 order book snapshot, including bids and asks with prices and sizes.
                Returns a JSON string with an error message if the query fails.
        """
        try:
            data = info.l2_snapshot(coin_name)
            return json.dumps(data)
        except Exception as e:
            return json.dumps({"error": f"Failed to fetch L2 snapshot: {str(e)}"})
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool fetches data (implied read-only) and mentions error handling, but lacks details on rate limits, authentication needs, or data freshness. It adds some behavioral context but is incomplete for a tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the main purpose, followed by structured parameter and return sections. Every sentence adds value, though it could be slightly more concise by integrating the return details into the main description.

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

Completeness3/5

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

Given the tool's moderate complexity (fetching financial data), no annotations, and no output schema, the description is adequate but has gaps. It explains parameters and returns well, but lacks usage context, error specifics, or behavioral details like latency or data format nuances, making it minimally complete.

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 description adds significant meaning beyond the input schema, which has 0% coverage. It explains that 'coin_name' is a trading symbol with examples ('BTC', 'ETH'), clarifies the purpose of the parameter, and notes that 'ctx' is for server state access, compensating well for the low schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Fetch') and resource ('Level 2 order book snapshot for a specific coin'), distinguishing it from sibling tools that fetch different data types like metadata, user data, or historical information. It precisely identifies what the tool retrieves.

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 among the many sibling tools. It mentions the specific data fetched but does not indicate scenarios, prerequisites, or comparisons to other tools like get_candles_snapshot or get_user_open_orders.

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

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