get_user_state
Query trading positions, margin details, and withdrawable balance for Hyperliquid accounts to monitor portfolio status and risk exposure.
Instructions
Query user state including trading positions, margin, and withdrawable balance.
Parameters:
account_address (str): The Hyperliquid account address (e.g., '0xcd5051944f780a621ee62e39e493c489668acf4d').
check_spot (bool, optional): If True, queries spot user state; otherwise, queries perpetuals state. Defaults to False.
ctx (Context, optional): The MCP context object for accessing server state.
Returns:
str: A JSON string containing the user state, including a list of positions (with symbol, size, entry_price,
current_price, unrealized_pnl), margin_summary, and withdrawable balance. Returns a JSON string with an
error message if the query fails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_address | Yes | ||
| check_spot | No |
Input Schema (JSON Schema)
{
"properties": {
"account_address": {
"title": "Account Address",
"type": "string"
},
"check_spot": {
"default": false,
"title": "Check Spot",
"type": "boolean"
}
},
"required": [
"account_address"
],
"type": "object"
}