Skip to main content
Glama

get_lighter_orderbook

Read-onlyIdempotent

Get the current Lighter.xyz orderbook snapshot for a coin. Returns bids, asks, mid price, and spread. Optionally specify depth.

Instructions

Get the current Lighter.xyz orderbook snapshot for a coin. Returns bids, asks, mid price, and spread. Optionally specify depth. Requires Pro tier for full depth.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesLighter.xyz coin symbol, e.g. 'BTC', 'ETH'
depthNoOrderbook depth — number of price levels per side

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesResult data object

Implementation Reference

  • src/index.ts:791-798 (registration)
    Registration of the 'get_lighter_orderbook' tool via the registerOrderbookTool helper pattern. It passes LighterCoinParam as the input schema and delegates to api().lighter.orderbook.get().
    // 24. Lighter Orderbook
    registerOrderbookTool(
      "get_lighter_orderbook",
      "Get the current Lighter.xyz orderbook snapshot for a coin. Returns bids, asks, mid price, and spread. Optionally specify depth. Requires Pro tier for full depth.",
      (coin, params) => api().lighter.orderbook.get(coin, params),
      LighterCoinParam,
      normalizeLighterCoin
    );
  • Generic orderbook tool handler. This is the actual function that executes when 'get_lighter_orderbook' is called: it normalizes the coin (via normalizeLighterCoin), optionally passes depth param, calls the SDK, and formats the response.
    function registerOrderbookTool(
      name: string,
      description: string,
      sdkCall: (coin: string, params?: { depth?: number }) => Promise<unknown>,
      coinSchema: z.ZodString,
      normFn: (coin: string) => string
    ): void {
      registerTool(
        name,
        description,
        { coin: coinSchema, depth: DepthParam },
        ObjectOutputSchema,
        async (params) => {
          const sdkParams = params.depth ? { depth: params.depth } : undefined;
          const data = await sdkCall(normFn(params.coin), sdkParams);
          return formatResponse(data);
        }
      );
    }
  • Input schema (Zod param) for the Lighter coin parameter used by get_lighter_orderbook.
    const LighterCoinParam = z
      .string()
      .describe("Lighter.xyz coin symbol, e.g. 'BTC', 'ETH'");
  • Normalization helper that uppercases the Lighter coin symbol before passing it to the SDK.
    function normalizeLighterCoin(coin: string): string {
      return coin.toUpperCase();
    }
    
    function normalizeSpotCoin(coin: string): string {
      return coin.toUpperCase();
    }
  • Helper function that defines the pattern for registering orderbook tools. It sets up input schema (coin + depth), output schema (ObjectOutputSchema), and the handler logic.
    function registerOrderbookTool(
      name: string,
      description: string,
      sdkCall: (coin: string, params?: { depth?: number }) => Promise<unknown>,
      coinSchema: z.ZodString,
      normFn: (coin: string) => string
    ): void {
      registerTool(
        name,
        description,
        { coin: coinSchema, depth: DepthParam },
        ObjectOutputSchema,
        async (params) => {
          const sdkParams = params.depth ? { depth: params.depth } : undefined;
          const data = await sdkCall(normFn(params.coin), sdkParams);
          return formatResponse(data);
        }
      );
    }
Behavior4/5

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

Annotations already indicate safety (readOnlyHint=true, destructiveHint=false). The description adds value by noting the Pro tier requirement, which is a behavioral constraint not captured in annotations. There is no contradiction.

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 two sentences covering purpose, returns, optional depth, and a constraint. Every sentence adds value without redundancy or fluff.

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

Completeness5/5

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

For a simple snapshot tool with an output schema, the description sufficiently covers purpose, parameters, returns, and a notable constraint (Pro tier). No gaps are evident.

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 both parameters described. The description adds minimal information beyond the schema: 'coin' is a symbol, 'depth' is number of price levels. No additional semantics are provided, so 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 states the tool 'Get the current Lighter.xyz orderbook snapshot for a coin' with specific verb and resource. It explicitly lists returned fields (bids, asks, mid price, spread) and mentions optional depth. The name and description distinguish it from sibling orderbook tools by specifying 'Lighter.xyz'.

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 provides context for usage by noting the optional depth parameter and the Pro tier requirement for full depth. However, it does not differentiate this tool from similar siblings like get_lighter_l3_orderbook or get_lighter_orderbook_history, nor does it indicate when to use this over others.

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