get_funding_current
Retrieve the current funding rate, premium, and timestamp for a specified coin on Hyperliquid.
Instructions
Get the current Hyperliquid funding rate for a coin. Returns the latest funding rate, premium, and timestamp.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | Coin/market symbol, e.g. 'BTC', 'ETH', 'SOL' |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Result data object |
Implementation Reference
- src/index.ts:518-525 (registration)Registration of the 'get_funding_current' tool using the registerCurrentTool helper pattern. It calls api().hyperliquid.funding.current(coin) with a CoinParam schema and normalizeHLCoin normalization.
// 6. Funding Current registerCurrentTool( "get_funding_current", "Get the current Hyperliquid funding rate for a coin. Returns the latest funding rate, premium, and timestamp.", (coin) => api().hyperliquid.funding.current(coin), CoinParam, normalizeHLCoin ); - src/index.ts:373-384 (helper)The 'registerCurrentTool' helper function that defines the handler pattern for current-snapshot tools like get_funding_current. It takes an SDK call function, validates the coin parameter, normalizes it, calls the SDK, and formats the response.
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); }); } - src/index.ts:328-358 (helper)The core 'registerTool' function that wraps every tool with API key validation (returns MISSING_KEY_MESSAGE if no client), error handling (catches and formats OxArchiveError), and registers the tool on the MCP server with annotations.
function registerTool( name: string, description: string, inputSchema: ZodRawShape, outputSchema: ZodRawShape, handler: (params: any) => Promise<McpContent> ): void { server.registerTool( name, { description, inputSchema, outputSchema, annotations: TOOL_ANNOTATIONS, }, async (params: any) => { if (!client) { return { content: [{ type: "text" as const, text: MISSING_KEY_MESSAGE }], isError: true, }; } try { return await handler(params); } catch (err) { const error = err instanceof OxArchiveError ? err : new OxArchiveError(String(err), 500); return formatError(error); } } ); } - src/index.ts:53-56 (schema)The CoinParam schema used by get_funding_current for the 'coin' input parameter. Accepts a string describing a coin/market symbol like 'BTC', 'ETH', 'SOL'.
const CoinParam = z .string() .describe("Coin/market symbol, e.g. 'BTC', 'ETH', 'SOL'"); - src/index.ts:138-141 (schema)The ObjectOutputSchema used as the output schema for get_funding_current. Wraps the result data in a single 'data' object.
// For tools that return a single object (current snapshots, orderbooks, data quality) const ObjectOutputSchema: ZodRawShape = { data: z.record(z.unknown()).describe("Result data object"), };