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],
      };
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool's purpose but doesn't describe behavioral traits such as whether it's read-only, potential rate limits, authentication needs, or what happens with missing data. This leaves significant gaps for a tool with no annotation coverage.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on usage, behavioral context, or output format, which would be helpful for an agent to invoke it correctly.

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 description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any additional meaning beyond what the schema provides, such as examples of valid intervals or token symbols, which keeps it at the baseline score.

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 action ('Get candlestick data') and resource ('for a token on Hyperliquid'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_all_mids' or 'get_l2_book', which likely serve different purposes in the same domain.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools or contexts where this tool is appropriate, leaving the agent to infer usage based on the name and parameters alone.

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/mektigboy/server-hyperliquid'

If you have feedback or need assistance with the MCP directory API, please join our Discord server