get_all_mids
Retrieve mid prices for all cryptocurrencies on the Hyperliquid exchange to access current market valuation data.
Instructions
Get mid prices for all coins on Hyperliquid
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/actions.ts:18-24 (handler)The handler function that executes the tool logic: fetches all mids using the Hyperliquid client's allMids method and returns a formatted response.export async function getAllMids(hyperliquidClient: PublicClient) { let allMids = await hyperliquidClient.allMids(); return { content: [{ type: "text", text: JSON.stringify(allMids) }], isError: false, }; }
- src/tools.ts:3-11 (schema)Tool schema definition including name, description, and input schema (empty object since no parameters are required).export const ALL_MIDS_TOOL: Tool = { name: "get_all_mids", description: "Get mid prices for all coins on Hyperliquid", inputSchema: { type: "object", properties: {}, required: [], }, };
- src/index.ts:75-80 (registration)Registers the get_all_mids tool (as ALL_MIDS_TOOL) in the MCP server's ListToolsRequestHandler.server.setRequestHandler(ListToolsRequestSchema, async () => { console.error("Received ListToolsRequest"); return { tools: [ALL_MIDS_TOOL, CANDLE_SNAPSHOT_TOOL, L2_BOOK_TOOL], }; });
- src/index.ts:46-48 (registration)Dispatches incoming CallToolRequests for "get_all_mids" to the getAllMids handler function.case "get_all_mids": { return await getAllMids(hyperliquidClient); }