Skip to main content
Glama
mektigboy

Hyperliquid MCP Server

by mektigboy

get_candle_snapshot

Retrieve candlestick data for specific tokens on Hyperliquid exchange to analyze price movements and market trends over defined time intervals.

Instructions

Get candlestick data for a token on Hyperliquid

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesThe symbol of the token to get candlestick data for
intervalYesTime interval (e.g., '15m', '1h')
startTimeYesStart time in milliseconds since epoch
endTimeNoEnd time in milliseconds since epoch (optional)

Implementation Reference

  • The main handler function that validates the input arguments using candleSnapshotSchema, fetches the candle snapshot data from the Hyperliquid client, and returns a formatted response.
    export async function getCandleSnapshot(
      hyperliquidClient: PublicClient,
      args: unknown
    ) {
      const validatedArgs = candleSnapshotSchema.parse(args);
      const candleSnapshot = await hyperliquidClient.candleSnapshot(validatedArgs);
      return {
        content: [{ type: "text", text: JSON.stringify(candleSnapshot) }],
        isError: false,
      };
    }
  • Zod schema for validating and transforming the input arguments (symbol to coin) for the get_candle_snapshot tool.
    export const candleSnapshotSchema = z
      .object({
        symbol: z.string({ required_error: "Symbol must be a string" }),
        interval: z.string({ required_error: "Interval must be a string" }),
        startTime: z.number({ required_error: "Start time must be a number" }),
        endTime: z.number().nullable().optional(),
      })
      .strict()
      .transform((data) => ({
        coin: data.symbol,
        interval: data.interval,
        startTime: data.startTime,
        endTime: data.endTime,
      }));
  • src/index.ts:49-51 (registration)
    Registration of the tool handler in the switch statement of the CallToolRequest handler.
    case "get_candle_snapshot": {
      return await getCandleSnapshot(hyperliquidClient, args);
    }
  • MCP Tool definition including the name, description, and input schema for get_candle_snapshot.
    export const CANDLE_SNAPSHOT_TOOL: Tool = {
      name: "get_candle_snapshot",
      description: "Get candlestick data for a token on Hyperliquid",
      inputSchema: {
        type: "object",
        properties: {
          coin: {
            type: "string",
            description: "The symbol of the token to get candlestick data for",
          },
          interval: {
            type: "string",
            description: "Time interval (e.g., '15m', '1h')",
          },
          startTime: {
            type: "number",
            description: "Start time in milliseconds since epoch",
          },
          endTime: {
            type: "number",
            description: "End time in milliseconds since epoch (optional)",
          },
        },
        required: ["coin", "interval", "startTime"],
      },
    };
  • src/index.ts:75-80 (registration)
    Registration of the tool in the ListToolsRequest handler, including CANDLE_SNAPSHOT_TOOL in the returned tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.error("Received ListToolsRequest");
      return {
        tools: [ALL_MIDS_TOOL, CANDLE_SNAPSHOT_TOOL, L2_BOOK_TOOL],
      };
    });

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states 'Get candlestick data', which implies a read operation but does not disclose the response format, whether data is historical or live, any rate limits, or how the snapshot is constructed. This lack of behavioral context leaves the agent uncertain about side effects and return expectations.

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 concise sentence, front-loaded with the action and resource. It is efficient with no wasted words, though it is terse enough to omit context that could be valuable. The structure is straightforward, but the brevity slightly reduces its effectiveness.

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

Completeness2/5

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

Given there is no output schema and no annotations, the description is insufficiently complete. It does not explain the structure of the returned data, time range handling, or any restrictions. The tool has four parameters, and the description only gives a high-level purpose without covering operational aspects.

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 input schema already provides descriptions for all four parameters (100% coverage), so the description adds no additional parameter semantics. The description's mention of 'a token' aligns with the 'coin' parameter but does not add meaningful detail beyond what the schema provides.

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 uses a specific verb 'get' and identifies the resource as 'candlestick data for a token on Hyperliquid', which clearly distinguishes it from sibling tools dealing with orders, positions, or market metadata. The tool name and description align, leaving no ambiguity about the function.

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 no explicit guidance on when to use this tool versus alternatives, and does not mention exclusions or alternative tools. Usage must be inferred from the tool name and the phrase 'candlestick data', making it implied rather than explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools