Skip to main content
Glama

OpenFinance — Easy Trading: Crypto, Stocks, Perps & Prediction Markets

hyperliquid

Hyperliquid: perps + spot trading, account state, orders, TWAP, leverage, withdrawals, account abstraction, and websocket data. Single-tool dispatch on action. Pass only the params listed below for each action; everything else is ignored.

CHAIN MODEL — read this before describing deposits/withdrawals to a user: Hyperliquid is its OWN L1 trading venue. It is NOT "Hyperliquid on Arbitrum" and there is no "USDC on Hyperliquid (Arbitrum)" ticker. The bridge is the only link to Arbitrum: - FUND: the user's OpenFinance address (get_deposit_address) is their OWN wallet, the same address on every EVM chain and on Hyperliquid. USDC only counts once it is IN the Hyperliquid account. Ways in: (1) from another Hyperliquid account, a Hyperliquid transfer to this address (instant); (2) USDC in the user's wallet on Arbitrum or another chain: move it with relay_get_quote then relay_execute to Hyperliquid (destinationChainId 1337, destination currency Perps USDC 0x00000000000000000000000000000000), recipient left empty (defaults to the user's own address); pass usePermit: true when the wallet has no gas token on the source chain. Sending USDC to this address on Arbitrum does NOT deposit it to Hyperliquid by itself; never say it does. Never give out a bridge contract address (bridge deposits credit whoever sent them), and never suggest HyperEVM for trading funds. - EXIT: action='withdraw_to_arbitrum' burns Hyperliquid USDC and the validators co-sign a payout to the SAME EOA on Arbitrum (flat $1 fee, ~5 min). Hyperliquid only accepts USDC, not USDT or USDC.e. Funding-from-INR routing is therefore: onramp INR → USDC on Polygon/BSC (Onramp.money supports those for USDC), bridge USDC → Hyperliquid via Relay (destinationChainId 1337), recipient = the user's own address. Never tell the user to onramp to "USDC on Hyperliquid" or "USDC on Arbitrum (Hyperliquid)" — those phrases are wrong.

PUBLIC DATA (no auth): get_all_mids — {}: map of asset symbol → mid price. get_market_metas — { kind?: 'all'|'perp'|'spot' (default 'all'), dex? }: 'all' returns asset contexts (funding rate, OI, mark/mid/oracle px, 24h vol, prevDayPx); 'perp' returns the perp universe (asset indices, name, szDecimals, maxLeverage, marginTableId, isDelisted) — use it for each market's exact name (send it as coin); 'spot' returns spot universes/pairs and contexts (midPx, markPx, supplies, day volumes). get_perp_categories — {}: returns [[symbol, category], ...] for every HIP-3 (dex-prefixed) perp. Categories: 'crypto', 'stocks', 'commodities', 'indices', 'fx', 'preipo'. Symbols are dex-prefixed (e.g. 'xyz:NVDA', 'vntl:SPACEX', 'km:GOLD', 'flx:BTC', 'para:OTHERS'). Use for discovery — "list HIP-3 stock perps", "what FX HIP-3 perps exist", "show commodities", "what pre-IPO perps are listed" — without walking the whole metas universe. To place an order on one of these symbols, send the symbol itself as coin (e.g. "xyz:NVDA"); the server resolves the asset id and szDecimals. get_l2_book — { coin }: L2 orderbook (bids/asks with px, sz, n). get_token_details — { tokenId }: spot token details (full hex hash from spot universe — e.g. "0xc1fb593aeffbeb02f85e0308e9956a90", not a simple number). get_candle_snapshot — { coin, interval, startTime, endTime? }: OHLCV candles. Intervals: 1m,3m,5m,15m,30m,1h,2h,4h,8h,12h,1d,3d,1w,1M. For HIP-3 spot prefix coin like "xyz:XYZ100".

ACCOUNT (auth). Every user-scoped read below — get_account_summary, get_open_orders, get_historical_orders, get_order_status, get_user_fills, get_user_funding_history, get_twap_fills, get_user_abstraction, get_rate_limit — accepts an OPTIONAL address (0x-prefixed). When set, the call returns that address's data instead of the caller's. Omit it for the caller's own data. Use for watchlists / copy-trading / "show me what wallet X is doing" queries. Note: get_deposit_address is caller-only by design (depositing on someone else's behalf doesn't make sense). get_deposit_address — {}: returns the user's own OpenFinance wallet address (same address on every EVM chain and on Hyperliquid). It is NOT a bridge: USDC sent here on Arbitrum or any other chain stays in the user's wallet on that chain until moved into Hyperliquid with Relay (see FUND). Only a transfer from another Hyperliquid account lands on Hyperliquid directly. get_account_summary — { view?: 'perp'|'all' (default 'perp') }: 'perp' returns the unified snapshot — clearinghouseState across the native dex AND every HIP-3 dex (xyz, flx, vntl, hyna, km, abcd, cash, para, …) with each dex's marginSummary/withdrawable/assetPositions, plus spotClearinghouseState (token balances) and userAbstraction in one response. So one call gets perp positions on every dex + spot — do NOT loop per-dex, and there is no separate 'spot' view (read spotClearinghouseState from the same response). 'all' is different: it returns the time-series portfolio (equity curve over windows), not a current snapshot. get_batch_portfolio_states — { users: string[] }: portfolio snapshot for ANY list of Hyperliquid addresses — NOT the caller's. Always against ALL_DEXES (native + every HIP-3 dex + spot per address). Use when the user wants to track/compare other traders ("watch wallet X", "compare these 3 addresses", leaderboard, copy-trading dashboard). One round-trip; fans out across dexes server-side. Do NOT loop get_account_summary; do NOT pass the caller's own address (use get_account_summary for that). users must be a non-empty array. Response shape: { successful_states: [[address, { clearinghouseState: { native, xyz, flx, … per dex }, spotClearinghouseState: { balances: [...] }, userAbstraction }], …], failed_wallets: string[] } — successful_states is an array of [address, portfolio] tuples (NOT a dict), so iterate with entry[0] = address, entry[1] = portfolio. Check failed_wallets for any address that couldn't be fetched. get_rate_limit — {}: current API rate-limit window.

ORDERS (auth): get_open_orders — { verbose? }: open orders (verbose=true adds origSz, triggerPx, triggerCondition, cloid, reduceOnly). get_historical_orders — {}: filled/cancelled/rejected orders with statusMsg, filledSz, avgFillPx. get_order_status — { oid }: status of a specific order.

⚠ REQUEST-SHAPE WARNING (most common MCP failure mode) — the request body uses Hyperliquid's SINGLE-LETTER field names. Plus coin (the market name). The other human-readable names (is_buy / sz / limit_px / order_type / reduce_only) only appear in GET responses; the REQUEST side REJECTS those names. Sending them is refused with BAD_ORDER naming the right field. ❌ WRONG (refused with BAD_ORDER — is_buy / sz / limit_px / order_type / reduce_only are not request fields; coin is fine): { "orders": [{ "coin": "xyz:NVDA", "is_buy": false, "sz": 0.052, "limit_px": 384.96, "order_type": { "limit": { "tif": "FrontendMarket" } }, "reduce_only": false }], "grouping": "na" } ✅ RIGHT: { "orders": [{ "coin": "xyz:NVDA", "b": false, "s": "0.052", "p": "384.96", "t": { "limit": { "tif": "FrontendMarket" } }, "r": false }], "grouping": "na" }

PERPS (main dex and HIP-3): pass coin = the market name exactly as in get_market_metas kind='perp' ("ETC", "kPEPE", "xyz:TSLA"). The SERVER looks up the asset id — do NOT compute a for perps; a miscount trades a different market. Unknown names → UNKNOWN_COIN; sending both coin and a different a → ASSET_MISMATCH. Same for cancel_order, modify_order, place_twap_order, terminate_twap_order, update_leverage and update_isolated_margin. A BARE name ("HYPE") is always the PERP. SPOT: pass the pair as coin ("PURR/USDC", or "@107" as get_open_orders reports it). HIP-4 outcomes: coin "#" (e.g. "#351"). With coin, the server also fills in szDecimals for perps (a different one sent alongside → ASSET_MISMATCH). ASSET INDEX (a) — still accepted instead of coin, never needed: • Spot pairs: a = 10000 + spotInfo.index (PURR/USDC: spotInfo.index=0 → a=10000; from get_market_metas kind='spot') • HIP-4 outcomes: a = 100_000_000 + (10 * outcome + side) (outcome=35 / side=Yes(1) → encoding 351 → a=100000351 — EIGHT zeros after the 1, NOT five — easy to miscount) Reference: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/asset-ids

place_order — { orders: [{ coin, b, p, s, r, t, c?, szDecimals? }], grouping?: 'na'|'normalTpsl'|'positionTpsl' }: coin = market name: perp "ETC", spot "PURR/USDC"/"@107", HIP-4 "#351" (server resolves the id; a is accepted, never needed). b = true(buy)/false(sell). p = price STRING ("65000"). s = size STRING in base-asset units. r = reduceOnly bool. c = optional cloid. szDecimals = size precision: for a perp sent by coin the server fills it in from the market and lot-rounds price/size to HL's rules before signing. For spot / HIP-4 / orders sent by a, pass it from get_market_metas — when omitted, the backend only strips trailing zeros, so fractional sizes that don't match HL's lot rules sign at a different value than intended. t = order type, EXACTLY ONE branch: • { "limit": { "tif": "Gtc" | "Ioc" | "Alo" | "FrontendMarket" } } — Gtc=resting, Ioc=cross-book (buy-now), Alo=post-only, FrontendMarket=stock-perp default for HIP-3 • { "trigger": { "isMarket": bool, "triggerPx": "string-or-number", "tpsl": "tp" | "sl" } } grouping = "na" (default) | "normalTpsl" (group TP/SL with primary) | "positionTpsl" (attach TP/SL to existing position).

On "insufficient" errors the response carries `insufficientCollateral: [{ requiredAsset, dex, context, message }]` — the collateral asset is NOT always the same: native perps = USDC, HIP-4 outcomes = USDC, HIP-3 perps use the dex's `collateralToken` (per dex `meta`, usually USDC, occasionally USDH for a few dexes). Relay requiredAsset + message verbatim — if a HIP-3 dex asks for USDH, swap USDC → USDH on Hyperliquid spot (see "USDH SWAP" below) before retrying. HIP-4 outcome trades just need USDC.

cancel_order — { cancels: [{ coin | a, o }] }: coin = the open order's market name (as get_open_orders reports it), or a = numeric asset index; o = order id. modify_order — { oid, order: { coin | a, b, p, s, r, t, c?, szDecimals } }: same shape as place_order order.

USDH SWAP (USDC → USDH) — only for HIP-3 dexes whose collateralToken is USDH (NOT needed for HIP-4 outcomes, which use USDC): 1. get_market_metas kind='spot' → find the universe entry whose tokens reference USDH (commonly name 'USDH/USDC') → note its index AND the pair's szDecimals. 2. Use the pair as coin (e.g. coin: "USDH/USDC", or "@"). 3. place_order with { coin, b: true, p: <USDH price ≈ "1.00">, s: <USDC amount as a decimal STRING, rounded to szDecimals>, r: false, t: { "limit": { "tif": "Ioc" } }, szDecimals }. Ioc fills immediately at or better than the limit. 4. Confirm: get_account_summary → look for coin='USDH' in spotClearinghouseState.balances. Same flow for any spot swap (USDC→HYPE, USDC→PURR, …) — only the pair differs.

PRE-ORDER CHECKLIST (run BEFORE every place_order — especially HIP-3 / HIP-4): 1. get_account_summary to read unifiedFreeUSDC = clearinghouseState.withdrawable + spotClearinghouseState.balances.USDC.total and userAbstraction. 2. If userAbstraction ∈ {"default", "disabled"} AND clearinghouseState.withdrawable > 0, call set_user_abstraction { abstraction: "u" } first (one-shot, idempotent — surface as a notice, not a confirmation prompt). 3. HIP-3 perp: check the dex's collateralToken. If USDH and user has no USDH balance → run USDH SWAP first. 4. HIP-4 outcome: settles in USDC — same unifiedFreeUSDC check as native perps. No USDH, no swap. 5. Perps sent by coin get szDecimals from the server; for spot pass the pair's szDecimals from get_market_metas kind='spot'.

TWAP (auth): get_twap_fills — {}: per-slice executions. place_twap_order — { coin | a, b, s, m, r?, t?, szDecimals? }: coin = perp market name (or a = asset index), b=true/false, s=total size, m=duration minutes, r=reduceOnly, t=randomize-timing boolean (NOT the order-type object), szDecimals=optional size precision from get_market_metas (when passed the backend lot-rounds s). terminate_twap_order — { twapId, coin | asset }: coin = the TWAP's market name (or asset = numeric id).

FILLS / FUNDING (auth): get_user_fills — { startTime?, endTime?, aggregateByTime? }: pass startTime to filter by time range; otherwise returns latest. get_user_funding_history — {}: funding payments (fundingRate, usdc amount, timestamp, position size).

LEVERAGE / MARGIN (auth): update_leverage — { coin | asset, leverage, isCross }: coin = perp market name (or asset = numeric id). leverage = whole number ≥ 1. isCross is REQUIRED: true = cross margin, false = isolated (leaving it out is refused, so a position is never switched to isolated by accident). update_isolated_margin — { coin | asset, amount, isBuy }: amount in USD; positive adds, negative removes. isBuy = true for a LONG position, false for a SHORT (not add/remove).

WITHDRAWAL (auth): withdraw_to_arbitrum — { amount }: USDC to caller's own EVM address on Arbitrum (flat $1 fee, ~5 min finality).

ACCOUNT ABSTRACTION (auth): get_user_abstraction — {}: returns 'unifiedAccount' | 'portfolioMargin' | 'disabled' | 'default' | 'dexAbstraction'. set_user_abstraction — { abstraction: 'u' }: switches to unifiedAccount (only supported mode; one-shot per wallet).

WEBSOCKET: set_all_dexs_asset_ctxs_subscription — { subscribe }: make sure the live allDexsAssetCtxs stream is on. It is shared by every caller, so subscribe=false leaves it on. get_all_dexs_asset_ctxs — {}: latest cached snapshot. Returns array indexed by asset position from get_market_metas — call that to map indices to names. get_ws_status — {}: { connected: boolean }.

OUTCOMES (HIP-4 — Hyperliquid's prediction-market-style binary outcomes): Each outcome has two sides (No=0, Yes=1). Outcomes are grouped under questions; a question carries a fallbackOutcome plus a list of namedOutcomes. Collateral: HIP-4 outcomes settle in USDC — same as native perps. split/merge/negate burn or mint USDC, and buying/selling outcome share tokens via place_order debits/credits USDC. No USDH and no spot swap is needed (this changed — HIP-4 used to require USDH; it no longer does). On "insufficient" errors the response carries insufficientCollateral: { requiredAsset: 'USDC', ... } — relay that to the user. Asset-ID encoding (used by place_order, modify_order, cancel_order for outcome tokens): encoding = 10 * outcome + side (side ∈ {0, 1}) spot coin: "#" token name: "+" asset ID: 100_000_000 + encoding Example: outcome=1, side=1 (Yes) → encoding 11 → spot "#11" → asset ID 100000011. Actions: get_outcome_meta — {} (no auth): returns BOTH the raw upstream payload AND a partitioned, metadata-enriched presentation view — • outcomes / questions — raw arrays from HL (backward-compat). • binaryMarkets — standalone Yes/No outcomes NOT grouped under any question. Simple "Will X happen?" bets. Each carries { outcome, name, description, sideSpecs, metadata }. Trade via place_order with the outcome's asset ID; resolve via split / merge. • questionMarkets — questions that group N named outcomes sharing one quote pool, resolving mutually exclusively. Each entry expands { question, name, description, metadata, fallbackOutcome, fallbackOutcomeDetail, namedOutcomes, namedOutcomeDetails (each with its own metadata), settledNamedOutcomes, settledNamedOutcomeDetails } so you can render the question's children without re-joining. Resolve via merge_question / negate_outcome. • counts — { binary, question, totalOutcomes, totalQuestions }.

  ⚠ DISPLAY NAMES ARE RECYCLED — every BTC daily market is named "Recurring", every named outcome inside one is "Recurring Named Outcome", the fallback is "Recurring Fallback". DO NOT use `name` alone to render — it tells the user nothing. The real semantics live in `metadata` (parsed from the description's "key:value|key:value" form):
    • Binary: `metadata.class === 'priceBinary'` with { underlying, expiry: "YYYYMMDD-HHmm" UTC, targetPrice, period } → render as "Will <underlying> hit $<targetPrice> by <expiry formatted>? (<period>)".
    • Question: `metadata.class === 'priceBucket'` with { underlying, expiry, priceThresholds: "T1,T2,…", period }. The named outcomes have `metadata.index = "0"|"1"|…` which maps to bucket ranges defined by the parent's thresholds:
        index=0 → <underlying> < T1
        index=k → T_k ≤ <underlying> < T_{k+1}
        index=N (last) → <underlying> ≥ T_N
        fallback (metadata.tag = "other") → settlement source unavailable / other
    • Other classes may exist (sports, elections, etc.) — surface metadata.class verbatim and any keys you recognize; fall back to raw `description` if nothing parses.
  Always present binaryMarkets and questionMarkets as TWO DISTINCT SECTIONS so a Yes/No bet isn't confused with a one-of-N question. Don't dump the flat outcomes array; route through the partitioned view.
split_outcome — { outcome, outcomeAmount }: burn outcomeAmount quote tokens, mint outcomeAmount Yes + outcomeAmount No shares. outcomeAmount is a decimal string (e.g. "123.0").
merge_outcome — { outcome, outcomeAmount? }: burn outcomeAmount Yes + outcomeAmount No → mint outcomeAmount quote. Omit outcomeAmount (or pass null) for max.
merge_question — { question, outcomeAmount? }: burn outcomeAmount Yes shares of every named outcome of the question → mint outcomeAmount quote. Omit/null for max.
negate_outcome — { question, outcome, outcomeAmount }: burn outcomeAmount No shares of one outcome → mint outcomeAmount Yes shares of every OTHER outcome of the same question.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "action": "<action>"
    },
    "name": "hyperliquid"
  }
}

Input Schema

NameRequiredDescriptionDefault
aNo
bNo
mNo
rNo
sNo
tNoTWAP randomize-timing flag (NOT the order-type object — that lives inside orders[].t)
dexNo
oidNo
coinNo
kindNo
viewNo
assetNo
isBuyNo
orderNoSingle order object for modify_order
usersNoHyperliquid addresses for get_batch_portfolio_states (at most 50)
actionYesWhich Hyperliquid action to perform — see tool description
amountNo
ordersNoArray of orders for place_order — see description for per-order shape
twapIdNo
addressNoOptional 0x-prefixed Hyperliquid address. When set, every user-scoped read (account, orders, fills, funding, abstraction, twap-fills, …) targets THAT address instead of the caller. Omit for the caller's own data.
cancelsNoArray of {coin, o} (or {a, o}) for cancel_order
endTimeNo
isCrossNo
outcomeNoOutcome id (HIP-4)
tokenIdNo
verboseNo
groupingNo
intervalNo
leverageNo
questionNoQuestion id (HIP-4)
startTimeNo
subscribeNo
szDecimalsNoOptional TWAP size precision (from get_market_metas) — when present the backend lot-rounds `s`.
abstractionNo
outcomeAmountNoHIP-4 split/merge/negate amount as a decimal string ("123.0"). Pass null for "max" on merge_outcome / merge_question.
aggregateByTimeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • addedInput schema / properties / oid / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / oid / minimum
      Added value: +-9007199254740991
    • changedInput schema / properties / oid / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / twapId / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / twapId / minimum
      Added value: +-9007199254740991
    • changedInput schema / properties / twapId / type
      Previous value: -"number"New value: +"integer"
    • changedInput schema / properties / users / description
      Previous value: -"Hyperliquid addresses for get_batch_portfolio_states"New value: +"Hyperliquid addresses for get_batch_portfolio_states (at most 50)"
    • addedInput schema / properties / users / maxItems
      Added value: +50
  2. Changed1 schema field changed
    • changedInput schema / properties / cancels / description
      Previous value: -"Array of {a, o} for cancel_order"New value: +"Array of {coin, o} (or {a, o}) for cancel_order"
  3. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden and does so: it discloses auth boundaries per section (PUBLIC vs auth), the single-letter request-shape rejection with a concrete BAD_ORDER example, error payload structure (`insufficientCollateral`), withdrawal cost and finality ($1, ~5 min), idempotency of set_user_abstraction, the shared/non-revocable nature of the websocket subscription, and the critical warning that sending USDC to the deposit address does not credit Hyperliquid.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Structure is strong — uppercase section headers, per-action blocks, worked WRONG/RIGHT examples — and the critical routing information is front-loaded. However, the text is far longer than needed for the payload: HIP-4 USDC collateral is re-explained three times ('No USDH and no spot swap is needed (this changed...)', the checklist item 4, and the OUTCOMES preamble), the USDH swap procedure is duplicated in prose and in the checklist, and the FUND/EXIT narrative repeats the 'never say USDC on Arbitrum' warning in several phrasings.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, yet the description documents return shapes where it matters (get_batch_portfolio_states tuple layout with iteration advice, get_account_summary unified snapshot contents, get_outcome_meta partitioned view with metadata rendering rules, get_ws_status). For a 34-action dispatcher this covers everything an agent needs to call and interpret the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is only 31% across 36 params, and the description compensates fully: it defines `b/s/p/r/t/c/a`, `coin` format per market type (perp name, 'PURR/USDC', '@107', '#351'), the asset-id arithmetic (10000 + spot index, 100_000_000 + encoding, with an explicit mis-count warning), `szDecimals` rounding consequences, `users` cardinality/shape, `address` scoping, `isCross` being required, and `isBuy` meaning long/short rather than add/remove.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening names the resource domain exhaustively (perps, spot, account state, orders, TWAP, leverage, withdrawals, account abstraction, websocket) and states the dispatch mechanism ('Single-tool dispatch on `action`'), then the body enumerates all 34 actions with one-line purposes. An agent can locate the right action without opening the schema, and the section on sibling tools (relay_get_quote/relay_execute for funding) makes the boundary explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when-to-use and when-not-to-use guidance throughout: 'do NOT loop per-dex', 'Do NOT loop get_account_summary; do NOT pass the caller's own address (use get_account_summary for that)', get_perp_categories 'without walking the whole metas universe', and a numbered PRE-ORDER CHECKLIST. It also gives conditional routing rules (USDH-only HIP-3 dexes, HIP-4 requires no swap) that select between paths.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.