get_instruments
Retrieve all Hyperliquid perpetual and spot instruments with leverage, decimals, and active status to discover valid coin symbols for further queries.
Instructions
List all available Hyperliquid perpetual and spot instruments with leverage, decimals, and active status. Use this to discover valid coin symbols before querying other endpoints.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| records | Yes | Array of result records | |
| count | Yes | Total number of records in the full result set | |
| nextCursor | No | Cursor for next page, if more results available |
Implementation Reference
- src/index.ts:463-467 (registration)Registration of the 'get_instruments' tool via registerInstrumentsTool, which delegates to the SDK's hyperliquid.instruments.list()
registerInstrumentsTool( "get_instruments", "List all available Hyperliquid perpetual and spot instruments with leverage, decimals, and active status. Use this to discover valid coin symbols before querying other endpoints.", () => api().hyperliquid.instruments.list() ); - src/index.ts:361-370 (helper)Helper function that wraps instrument-list tools with an empty input schema, calls the SDK function, and formats the response. Used by get_instruments.
function registerInstrumentsTool( name: string, description: string, sdkCall: () => Promise<unknown[]> ): void { registerTool(name, description, {}, ListOutputSchema, async () => { const data = await sdkCall(); return formatResponse(data); }); } - src/index.ts:328-358 (helper)Generic tool registration helper that calls server.registerTool with API key gating, error handling, and annotations. The actual handler for get_instruments executes via this wrapper.
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:129-136 (schema)Output schema for the get_instruments tool - returns an array of records with count and optional pagination cursor.
const ListOutputSchema: ZodRawShape = { records: z.array(z.record(z.unknown())).describe("Array of result records"), count: z.number().describe("Total number of records in the full result set"), nextCursor: z .string() .optional() .describe("Cursor for next page, if more results available"), };