Skip to main content
Glama

get_candles

Read-onlyIdempotent

Retrieve Hyperliquid OHLCV candle data for any coin. Specify interval (1m to 1w), start and end times, and limit. Returns open, high, low, close, and volume values.

Instructions

Get Hyperliquid OHLCV candle data for a coin. Intervals: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w (default 1h). Returns open, high, low, close, volume. Data available from April 2023.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesCoin/market symbol, e.g. 'BTC', 'ETH', 'SOL'
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
intervalNoCandle interval (default '1h')

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:509-516 (registration)
    Registration of the 'get_candles' tool using the registerCandleTool helper. It registers the Hyperliquid OHLCV candle endpoint with interval support (1m to 1w, default 1h).
    registerCandleTool(
      "get_candles",
      "Get Hyperliquid OHLCV candle data for a coin. Intervals: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w (default 1h). Returns open, high, low, close, volume. Data available from April 2023.",
      (coin, params) =>
        api().hyperliquid.candles.history(coin, params as any),
      CoinParam,
      normalizeHLCoin
    );
  • The handler lambda passed to registerCandleTool calls api().hyperliquid.candles.history(coin, params) with the normalized coin and params.
    registerCandleTool(
      "get_candles",
      "Get Hyperliquid OHLCV candle data for a coin. Intervals: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w (default 1h). Returns open, high, low, close, volume. Data available from April 2023.",
      (coin, params) =>
        api().hyperliquid.candles.history(coin, params as any),
      CoinParam,
      normalizeHLCoin
    );
  • The registerCandleTool helper function that wraps registerHistoryTool with an extra 'interval' parameter from IntervalParam.
    function registerCandleTool(
      name: string,
      description: string,
      sdkCall: (coin: string, params: Record<string, unknown>) => Promise<{ data: unknown; nextCursor?: string }>,
      coinSchema: z.ZodString,
      normFn: (coin: string) => string
    ): void {
      registerHistoryTool(
        name,
        description,
        sdkCall,
        coinSchema,
        normFn,
        { interval: IntervalParam }
      );
    }
  • The registerHistoryTool helper function that handles coin normalization, time range resolution, limit, cursor pagination, and extra params (like interval). This is the underlying pattern used by registerCandleTool.
    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);
      });
    }
  • The IntervalParam Zod enum schema defining valid candle intervals: '1m', '5m', '15m', '30m', '1h', '4h', '1d', '1w'.
    const IntervalParam = z
      .enum(["1m", "5m", "15m", "30m", "1h", "4h", "1d", "1w"])
      .optional()
      .describe("Candle interval (default '1h')");
Behavior4/5

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

Annotations already mark it as read-only, idempotent. Description adds context: returns OHLCV, default interval 1h, start defaults to 24h ago. No contradiction with annotations. Provides useful 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.

Conciseness5/5

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

Two clear sentences. Front-loaded with main purpose. Every word adds value. No redundancy or fluff.

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?

Covers key aspects: data type, intervals, availability, defaults. With an output schema present, return values are handled. However, it does not explain pagination or cursor usage, which is relevant for large datasets. Slightly incomplete but mostly sufficient.

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

Parameters5/5

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

Schema coverage is 100%, but description adds value by specifying defaults (interval='1h', start='24h ago', limit=100) and explaining output fields (open, high, low, close, volume). This goes beyond the schema descriptions.

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?

Clearly states 'Get Hyperliquid OHLCV candle data for a coin.' The verb (get) and resource (OHLCV candle data) are specific. It lists intervals and data fields, distinguishing it from other data tools like get_trades or get_orderbook. No ambiguity.

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?

Describes intervals and data availability from April 2023, but does not provide explicit guidance on when to use this vs sibling candle tools (e.g., get_hip3_candles, get_lighter_candles). No alternatives or exclusions 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