Skip to main content
Glama
t3rmed

Hyperliquid MCP Server

by t3rmed

get_user_fills_by_time

Retrieve user trading history and fill data from Hyperliquid DEX for specific time periods to analyze past trades and transaction records.

Instructions

Get trading history (fills) for a specific time range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endTimeNoEnd time in milliseconds
startTimeNoStart time in milliseconds
userNoUser wallet address (optional, defaults to configured wallet)

Implementation Reference

  • Tool schema definition with input validation for user, startTime, and endTime parameters.
    get_user_fills_by_time_tool = Tool(
        name="get_user_fills_by_time",
        description="Get trading history (fills) for a specific time range",
        inputSchema={
            "type": "object",
            "properties": {
                "user": {
                    "type": "string",
                    "description": "User wallet address (optional, defaults to configured wallet)",
                },
                "startTime": {
                    "type": "number",
                    "description": "Start time in milliseconds",
                },
                "endTime": {
                    "type": "number",
                    "description": "End time in milliseconds",
                },
            },
            "required": [],
        },
    )
  • Primary handler function that processes tool arguments, fetches fills via client, handles errors, and returns formatted text content with trade details.
    async def handle_get_user_fills_by_time(client: HyperliquidClient, args: Dict[str, Any]) -> Dict[str, Any]:
        """Handle get user fills by time request."""
        user = args.get("user")
        start_time = args.get("startTime")
        end_time = args.get("endTime")
    
        result = await client.get_user_fills_by_time(user, start_time, end_time)
    
        if not result.success:
            raise ValueError(f"Failed to get user fills by time: {result.error}")
    
        fills = result.data or []
    
        if not fills:
            return {
                "content": [
                    TextContent(
                        type="text",
                        text="No trading history found for the specified time range.",
                    )
                ]
            }
    
        fills_text = "\n".join(
            f"{datetime.fromtimestamp(fill['time'] / 1000).isoformat()}: {fill['coin']} {'BUY' if fill['side'] == 'B' else 'SELL'} {fill['sz']} @ {fill['px']} (Fee: {fill['fee']})"
            for fill in fills
        )
    
        return {
            "content": [
                TextContent(
                    type="text",
                    text=f"Trading History ({len(fills)} fills):\n\n{fills_text}",
                )
            ]
        }
  • Core API client method that sends POST request to Hyperliquid's /info endpoint with 'userFillsByTime' type and optional time filters to retrieve user fills.
    async def get_user_fills_by_time(
        self,
        user: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
    ) -> ApiResponse[List[UserFill]]:
        """Get trading history for a specific time range."""
        try:
            payload = {
                "type": "userFillsByTime",
                "user": user or self.config.wallet_address,
            }
            if start_time is not None:
                payload["startTime"] = start_time
            if end_time is not None:
                payload["endTime"] = end_time
    
            response = await self.client.post("/info", json=payload)
            response.raise_for_status()
            return ApiResponse(success=True, data=response.json())
        except Exception as e:
            return ApiResponse(success=False, error=str(e))
  • Tool registration in the main call_tool dispatcher, mapping tool name to handler execution.
    elif name == "get_user_fills_by_time":
        result = await handle_get_user_fills_by_time(client, args)
  • Tool handler mapping in HTTP server's TOOL_HANDLERS dictionary for HTTP deployment.
    "get_user_fills_by_time": handle_get_user_fills_by_time,
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does, not how it behaves. It doesn't disclose whether this requires authentication, rate limits, pagination behavior, error conditions, or what format the trading history returns. For a data retrieval tool with zero annotation coverage, this is insufficient.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero wasted words. It's appropriately sized and front-loads the core functionality without unnecessary elaboration.

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

Completeness3/5

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

For a read-only data retrieval tool with good schema coverage but no annotations or output schema, the description is minimally adequate. It states what the tool does but lacks behavioral context about authentication, response format, or error handling that would be helpful for an AI agent.

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

Parameters3/5

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

Schema description coverage is 100%, so parameters are fully documented in the schema. The description adds no additional parameter semantics beyond implying time range filtering. The baseline of 3 is appropriate when the schema does all the parameter documentation work.

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

Purpose4/5

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

The description clearly states the verb 'Get' and resource 'trading history (fills)' with scope 'for a specific time range', making the purpose unambiguous. It doesn't explicitly differentiate from sibling 'get_user_fills' (which lacks time parameters), but the time range specification provides implicit distinction.

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

Usage Guidelines3/5

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

The description implies usage when needing fills within a time range, but provides no explicit guidance on when to use this versus 'get_user_fills' (which presumably returns all fills without time filtering). No alternatives, exclusions, or prerequisites are mentioned.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/t3rmed/hyperliquid-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server