Skip to main content
Glama

get_freshness

Read-onlyIdempotent

Check data freshness for a coin across orderbook, trades, funding, open interest, and liquidations. Displays last update time and current lag for each data type.

Instructions

Get data freshness for a coin across all data types (orderbook, trades, funding, OI, liquidations). Shows when each data type was last updated and current lag.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesCoin/market symbol, e.g. 'BTC', 'ETH', 'SOL'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesResult data object

Implementation Reference

  • src/index.ts:603-610 (registration)
    Tool registration for 'get_freshness' using the registerCurrentTool helper pattern. Registered under Hyperliquid section (// 13. Freshness).
    // 13. Freshness
    registerCurrentTool(
      "get_freshness",
      "Get data freshness for a coin across all data types (orderbook, trades, funding, OI, liquidations). Shows when each data type was last updated and current lag.",
      (coin) => api().hyperliquid.freshness(coin),
      CoinParam,
      normalizeHLCoin
    );
  • The registerCurrentTool helper function (Pattern 2) acts as the handler factory. It wraps the SDK call api().hyperliquid.freshness(coin) inside a standard handler that normalizes the input coin, calls the SDK, and formats the response as a single object.
    function registerCurrentTool(
      name: string,
      description: string,
      sdkCall: (coin: string) => Promise<unknown>,
      coinSchema: z.ZodString,
      normFn: (coin: string) => string
    ): void {
      registerTool(name, description, { coin: coinSchema }, ObjectOutputSchema, async (params) => {
        const data = await sdkCall(normFn(params.coin));
        return formatResponse(data);
      });
    }
  • Input schema: CoinParam defines the 'coin' parameter as a string (e.g., 'BTC', 'ETH', 'SOL') which is the sole input to get_freshness.
    const CoinParam = z
      .string()
      .describe("Coin/market symbol, e.g. 'BTC', 'ETH', 'SOL'");
  • Output schema: ObjectOutputSchema defines the return type as a single object ({ data: ... }), used by get_freshness since it returns a current snapshot.
    const ObjectOutputSchema: ZodRawShape = {
      data: z.record(z.unknown()).describe("Result data object"),
    };
  • Helper: normalizeHLCoin converts the coin symbol to uppercase, used as the normalization function in the get_freshness registration.
    function normalizeHLCoin(coin: string): string {
      return coin.toUpperCase();
    }
    
    function normalizeHip3Coin(coin: string): string {
      return coin; // Case-sensitive
    }
    
    // HIP-4 path encoding: the canonical form is the bare numeric `0`, `1`, `42`.
    // The legacy `#0` / `%230` forms are still accepted by the API. We normalize to
    // the bare form when possible (avoids URL-fragment ambiguity entirely).
    function normalizeHip4Coin(coin: string): string {
      const trimmed = String(coin).trim();
      if (/^\d+$/.test(trimmed)) return trimmed;
      const stripped = trimmed.replace(/^(#|%23)/i, "");
      if (/^\d+$/.test(stripped)) return stripped;
      // Unknown shape — fall back to URL-encoding the original.
      return encodeURIComponent(trimmed);
    }
    
    function normalizeLighterCoin(coin: string): string {
      return coin.toUpperCase();
    }
    
    function normalizeSpotCoin(coin: string): string {
      return coin.toUpperCase();
    }
    
    // ---------------------------------------------------------------------------
    // G. Tool Registration Helpers
    // ---------------------------------------------------------------------------
    
    function registerTool(
Behavior4/5

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

The description adds value beyond annotations by specifying that the tool shows last update time and current lag for each data type. The annotations already indicate readonly and idempotent behavior, and the description does not contradict them. No side effects or error conditions are mentioned, but the core behavior is clear.

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 exceptionally concise at two sentences, with the purpose front-loaded in the first sentence and detail in the second. There is no redundant or unnecessary information.

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 presence of an output schema, the description does not need to detail return values. It adequately describes the input and high-level output. However, it could be more complete by explicitly situating this tool among the many freshness variants (e.g., noting it is for the standard market).

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?

The only parameter, 'coin', is fully described in the input schema with examples. The tool description does not add any further semantics about the parameter, so it meets the baseline expectation given 100% schema coverage. No additional parameter context is needed.

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 tool's purpose: getting data freshness for a coin across multiple data types. It lists the data types and explains what the output shows. However, it does not explicitly differentiate this base freshness tool from its many variants (e.g., get_hip3_freshness, get_spot_freshness) based on market context.

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 guidance is provided on when to use this tool instead of similar sibling tools. The description does not mention any prerequisites, when to prefer this over market-specific freshness tools, or any limitations. The openWorldHint is set but not explained.

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