get_user_fees
Retrieve fee structure and trading rates for a specific Hyperliquid account, including maker and taker fees for informed trading decisions.
Instructions
Fetch the fee structure and rates for a specific user account.
Parameters:
account_address (str): The Hyperliquid account address (e.g., '0xcd5051944f780a621ee62e39e493c489668acf4d').
ctx (Context): The MCP context object for accessing server state.
Returns:
str: A JSON string containing the user's fee structure, including maker and taker fees.
Returns a JSON string with an error message if the query fails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_address | Yes |
Input Schema (JSON Schema)
{
"properties": {
"account_address": {
"title": "Account Address",
"type": "string"
}
},
"required": [
"account_address"
],
"type": "object"
}
Implementation Reference
- main.py:217-235 (handler)The handler function for the 'get_user_fees' tool. It uses the Hyperliquid SDK's info.user_fees() to retrieve fee information for the given account_address and returns it as a JSON string, with error handling.@mcp.tool() async def get_user_fees(account_address: str, ctx: Context) -> str: """ Fetch the fee structure and rates for a specific user account. Parameters: account_address (str): The Hyperliquid account address (e.g., '0xcd5051944f780a621ee62e39e493c489668acf4d'). ctx (Context): The MCP context object for accessing server state. Returns: str: A JSON string containing the user's fee structure, including maker and taker fees. Returns a JSON string with an error message if the query fails. """ try: data = info.user_fees(account_address) return json.dumps(data) except Exception as e: return json.dumps({"error": f"Failed to fetch user fees: {str(e)}"})
- main.py:393-393 (helper)A prompt message in the analyze_positions prompt that references the get_user_fees tool among others for analyzing user positions.base.UserMessage("Use the get_user_state, get_user_open_orders, get_user_trade_history, get_user_funding_history, and get_user_fees tools to fetch data."),