get_instrument
Retrieve details for a Hyperliquid instrument by coin symbol, including leverage, decimals, and active status.
Instructions
Get details for a single Hyperliquid instrument by coin symbol. Returns leverage, decimals, and active status.
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:470-476 (registration)Registration of the 'get_instrument' tool via registerCurrentTool helper, using CoinParam schema and normalizeHLCoin normalization.
registerCurrentTool( "get_instrument", "Get details for a single Hyperliquid instrument by coin symbol. Returns leverage, decimals, and active status.", (coin) => api().hyperliquid.instruments.get(coin), CoinParam, normalizeHLCoin ); - src/index.ts:372-383 (handler)The registerCurrentTool helper function generates the actual handler for 'get_instrument'. It accepts a coin parameter, normalizes it via normFn (normalizeHLCoin), calls the SDK's hyperliquid.instruments.get method, and formats the response.
// Pattern 2: Current snapshot (coin only) 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:53-55 (schema)Input schema (CoinParam) used by 'get_instrument' — a simple string describing the coin symbol.
const CoinParam = z .string() .describe("Coin/market symbol, e.g. 'BTC', 'ETH', 'SOL'"); - src/index.ts:139-141 (schema)Output schema (ObjectOutputSchema) used by 'get_instrument' — wraps the response in a data object.
const ObjectOutputSchema: ZodRawShape = { data: z.record(z.unknown()).describe("Result data object"), }; - src/index.ts:296-298 (helper)Normalization helper that uppercases the coin symbol before passing to the SDK.
function normalizeHLCoin(coin: string): string { return coin.toUpperCase(); }