Skip to main content
Glama
mektigboy

Hyperliquid MCP Server

by mektigboy

get_candle_snapshot

Retrieve candlestick data for a specific token on Hyperliquid exchange by specifying the token symbol, time interval, and start time. Analyze historical market trends and price movements.

Instructions

Get candlestick data for a token on Hyperliquid

Input Schema

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

Implementation Reference

  • The handler function that implements the core logic of the 'get_candle_snapshot' tool. It validates the input arguments using candleSnapshotSchema, fetches the candle snapshot data from the Hyperliquid client, and returns the JSON-stringified result.
    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 used for input validation and transformation in the get_candle_snapshot handler (transforms 'symbol' to 'coin').
    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/tools.ts:13-38 (registration)
    MCP Tool registration definition including 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:49-51 (registration)
    Registration of the tool handler in the CallToolRequest switch statement, dispatching to the getCandleSnapshot function.
    case "get_candle_snapshot": { return await getCandleSnapshot(hyperliquidClient, args); }

Other Tools

Related 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