Skip to main content
Glama

get_lighter_orderbook_history

Read-onlyIdempotent

Access historical Lighter.xyz orderbook data with customizable granularity, returning L2 snapshots of bids and asks for a given coin and time range.

Instructions

Get historical Lighter.xyz orderbook snapshots. Returns L2 snapshots with bids/asks over a time range. Supports granularity levels: checkpoint (default), 30s, 10s, 1s, tick.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesLighter.xyz coin symbol, e.g. 'BTC', 'ETH'
startNoStart timestamp (Unix ms or ISO). Defaults to 24h ago.
endNoEnd timestamp (Unix ms or ISO). Defaults to now.
limitNoMax records to return (default 100, max 1000)
cursorNoPagination cursor from previous response's nextCursor
depthNoOrderbook depth — number of price levels per side
granularityNoOrderbook resolution: 'checkpoint' (default), '30s', '10s', '1s', 'tick' (Enterprise)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
recordsYesArray of result records
countYesTotal number of records in the full result set
nextCursorNoCursor for next page, if more results available

Implementation Reference

  • src/index.ts:800-815 (registration)
    Tool registration for 'get_lighter_orderbook_history' using the registerHistoryTool helper. Registers the tool with input schema (coin, start, end, limit, cursor, depth, granularity) and delegates to api().lighter.orderbook.history().
    // Lighter Orderbook History
    registerHistoryTool(
      "get_lighter_orderbook_history",
      "Get historical Lighter.xyz orderbook snapshots. Returns L2 snapshots with bids/asks over a time range. Supports granularity levels: checkpoint (default), 30s, 10s, 1s, tick.",
      (coin, params) =>
        api().lighter.orderbook.history(coin, params as any),
      LighterCoinParam,
      normalizeLighterCoin,
      {
        depth: DepthParam,
        granularity: z
          .enum(["checkpoint", "30s", "10s", "1s", "tick"])
          .optional()
          .describe("Orderbook resolution: 'checkpoint' (default), '30s', '10s', '1s', 'tick' (Enterprise)"),
      }
    );
  • Normalization helper: converts Lighter coin symbols to uppercase.
    function normalizeLighterCoin(coin: string): string {
      return coin.toUpperCase();
    }
  • registerHistoryTool — the generic registration function that builds the input schema (including coin, start, end, limit, cursor, plus extra params), resolves time range and limit, calls the SDK, and formats the cursor-based paginated response.
    // Pattern 4: History with cursor pagination (coin + time range)
    function registerHistoryTool(
      name: string,
      description: string,
      sdkCall: (coin: string, params: Record<string, unknown>) => Promise<{ data: unknown; nextCursor?: string }>,
      coinSchema: z.ZodString,
      normFn: (coin: string) => string,
      extraSchema?: ZodRawShape
    ): void {
      const schema: ZodRawShape = { coin: coinSchema, ...HistoryParams };
      if (extraSchema) Object.assign(schema, extraSchema);
    
      registerTool(name, description, schema, ListOutputSchema, async (params) => {
        const { coin, start, end, limit, cursor, ...extra } = params;
    
        const timeRange = resolveTimeRange(start, end);
        const sdkParams: Record<string, unknown> = {
          ...timeRange,
          limit: resolveLimit(limit),
        };
    
        if (cursor) sdkParams.cursor = cursor;
    
        // Pass through extra params (interval, side, etc.)
        for (const [k, v] of Object.entries(extra)) {
          if (v !== undefined) sdkParams[k] = v;
        }
    
        const result = await sdkCall(normFn(coin), sdkParams);
        return formatCursorResponse(result);
      });
    }
  • AggregationIntervalParam schema — used as part of the extraSchema for some history tools (though get_lighter_orderbook_history uses its own granularity param instead).
    const AggregationIntervalParam = z
      .enum(["5m", "15m", "30m", "1h", "4h", "1d"])
      .optional()
      .describe("Aggregation interval. Omit for raw ~1 min data.");
  • LighterCoinParam schema — defines the Lighter coin parameter accepted by the tool.
    const LighterCoinParam = z
      .string()
      .describe("Lighter.xyz coin symbol, e.g. 'BTC', 'ETH'");
Behavior4/5

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

Annotations already confirm readOnly, non-destructive, idempotent, and open-world behavior. The description adds value by specifying output type (L2 snapshots with bids/asks) and granularity options, which are behavioral traits beyond the annotations. It does not contradict annotations.

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?

Two concise sentences that front-load the purpose and then add a key feature (granularity). Every sentence is necessary and no wasted words.

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 tool has an output schema (not shown but noted), the description properly covers functionality: historical L2 snapshots with time range and resolution. It does not mention pagination (cursor) but that is in the schema. The description is sufficient for an agent to understand the tool's role.

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 all parameters described. The description briefly restates the granularity enum but adds no new semantic meaning beyond the schema. Baseline 3 is appropriate.

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 specifies the tool retrieves historical Lighter.xyz orderbook snapshots (L2 level) with bids/asks over a time range. This is a specific verb-resource combination that distinguishes it from other orderbook history tools for different exchanges or levels.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implicitly suggests use for Lighter.xyz L2 historical data, but lacks explicit when-to-use or when-not-to-use guidance compared to alternatives like get_l2_orderbook_history or get_lighter_l3_orderbook_history. No exclusions or alternatives mentioned.

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