get_account_info
Retrieve wallet balance, margin summary, and withdrawable funds for Hyperliquid exchange accounts to monitor portfolio value and manage risk.
Instructions
Get wallet balance, margin summary, and withdrawable funds
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/hyperliquid_mcp/client.py:40-51 (handler)The actual handler implementation that fetches account info from Hyperliquid API. Gets wallet state including margin summary, cross margin summary, and withdrawable funds.
def get_account_info(self) -> dict[str, Any]: """Get wallet balance, margin, and account summary.""" if not self.wallet_address: raise ValueError("HYPERLIQUID_WALLET_ADDRESS is required.") state = self.info.user_state(self.wallet_address) return { "address": self.wallet_address, "testnet": self.testnet, "margin_summary": state.get("marginSummary", {}), "cross_margin_summary": state.get("crossMarginSummary", {}), "withdrawable": state.get("withdrawable", "0"), } - src/hyperliquid_mcp/server.py:22-26 (registration)Tool registration with MCP server. Defines the tool name, description, and input schema (no parameters required).
Tool( name="get_account_info", description="Get wallet balance, margin summary, and withdrawable funds", inputSchema={"type": "object", "properties": {}, "required": []}, ), - Dispatch helper function that routes the tool call to the client method. Matches the tool name and calls client.get_account_info().
def _dispatch(client: HyperliquidClient, name: str, args: dict[str, Any]) -> Any: match name: case "get_account_info": return client.get_account_info()