Skip to main content
Glama

get_l4_orderbook

Read-onlyIdempotent

Retrieves Hyperliquid L4 orderbook at a specific timestamp, showing individual order IDs, user addresses, prices, and sizes for full market depth analysis.

Instructions

Get Hyperliquid L4 orderbook reconstruction (Pro+ tier). Returns full order-level orderbook at a specific timestamp with individual order IDs, user addresses, prices, and sizes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesCoin/market symbol, e.g. 'BTC', 'ETH', 'SOL'
timestampNoTimestamp for orderbook reconstruction (Unix ms or ISO)
depthNoOrderbook depth — number of price levels per side

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesResult data object

Implementation Reference

  • src/index.ts:1069-1088 (registration)
    Registration of the 'get_l4_orderbook' tool using registerTool(). Takes coin, timestamp, and optional depth params. Calls api().hyperliquid.l4Orderbook.get() with the normalized coin and SDK params.
    registerTool(
      "get_l4_orderbook",
      "Get Hyperliquid L4 orderbook reconstruction (Pro+ tier). Returns full order-level orderbook at a specific timestamp with individual order IDs, user addresses, prices, and sizes.",
      {
        coin: CoinParam,
        timestamp: TimestampParam.describe("Timestamp for orderbook reconstruction (Unix ms or ISO)"),
        depth: DepthParam,
      },
      ObjectOutputSchema,
      async (params) => {
        const sdkParams: Record<string, unknown> = {};
        if (params.timestamp != null) sdkParams.timestamp = toUnixMs(params.timestamp);
        if (params.depth) sdkParams.depth = params.depth;
        const data = await api().hyperliquid.l4Orderbook.get(
          normalizeHLCoin(params.coin),
          sdkParams as any
        );
        return formatResponse(data);
      }
    );
  • Handler for get_l4_orderbook. Builds SDK params from timestamp and depth, calls api().hyperliquid.l4Orderbook.get() with the normalized coin and params, then returns the formatted response.
      async (params) => {
        const sdkParams: Record<string, unknown> = {};
        if (params.timestamp != null) sdkParams.timestamp = toUnixMs(params.timestamp);
        if (params.depth) sdkParams.depth = params.depth;
        const data = await api().hyperliquid.l4Orderbook.get(
          normalizeHLCoin(params.coin),
          sdkParams as any
        );
        return formatResponse(data);
      }
    );
  • Input schema for get_l4_orderbook: coin (string), timestamp (number or string Unix ms/ISO), depth (optional number). Output schema: ObjectOutputSchema (single data object).
    {
      coin: CoinParam,
      timestamp: TimestampParam.describe("Timestamp for orderbook reconstruction (Unix ms or ISO)"),
      depth: DepthParam,
    },
    ObjectOutputSchema,
  • Helper function that returns the SDK client instance used by the handler to call hyperliquid.l4Orderbook.get().
    function api(): OxArchive {
      return client!;
    }
  • Helper function used by the handler to convert timestamp parameters (number or ISO string) to Unix milliseconds.
    function toUnixMs(ts: number | string): number {
      if (typeof ts === "number") return ts;
      // MCP/JSON-RPC may deliver numeric timestamps as strings
      if (/^\d+$/.test(ts)) return Number(ts);
      const parsed = Date.parse(ts);
      if (isNaN(parsed)) throw new Error(`Invalid timestamp: "${ts}"`);
      return parsed;
    }
Behavior3/5

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

Annotations already provide readOnlyHint, idempotentHint, and destructiveHint. The description adds that the tool returns full order-level data with order IDs, user addresses, prices, and sizes. It does not disclose limitations like historical range or rate limits, but provides some behavioral context beyond 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 a single sentence that front-loads the purpose and return contents. It is efficient with no redundancy, but could be slightly more structured.

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

Completeness4/5

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

Given the output schema exists and all parameters are documented, the description provides enough context for the tool's purpose and return format. It does not miss critical information for a snapshot read operation.

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

Parameters3/5

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

Schema coverage is 100% with descriptions for all parameters. The description adds no additional meaning to the parameters beyond what the schema provides, so baseline 3 is appropriate.

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 it gets Hyperliquid L4 orderbook reconstruction at a specific timestamp, listing returned fields. It specifies the resource but does not explicitly differentiate from sibling orderbook tools like get_l2_orderbook or get_l4_orderbook_history.

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?

No explicit guidance on when to use this tool versus alternatives. It implies usage for a snapshot at a specific timestamp, but does not address prerequisites, tier restrictions, or why one would choose this over L2 or other L4 endpoints.

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/0xArchiveIO/0xarchive-mcp'

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