Skip to main content
Glama
kukapay

aster-info-mcp

get_funding_rate_history

Retrieve historical funding rate data for cryptocurrency trading pairs to analyze market trends and funding costs over time.

Instructions

Fetch Funding Rate History data from Aster Finance API and return as Markdown table text.

Parameters:
    symbol (str): Trading pair symbol (e.g., 'BTCUSDT', 'ETHUSDT'). Case-insensitive.
    startTime (Optional[int]): Start time in milliseconds since Unix epoch. If None, defaults to API behavior.
    endTime (Optional[int]): End time in milliseconds since Unix epoch. If None, defaults to API behavior.
    limit (Optional[int]): Number of funding rate records to return (1 to 1000). If None, defaults to 100.

Returns:
    str: Markdown table containing symbol, fundingTime, and fundingRate.

Raises:
    Exception: If the API request fails or data processing encounters an error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
startTimeNo
endTimeNo
limitNo

Implementation Reference

  • main.py:311-374 (handler)
    The complete handler function for the 'get_funding_rate_history' tool, decorated with @mcp.tool() for registration. It fetches funding rate history from the Aster Finance API (/fapi/v1/fundingRate), processes the data using pandas into a formatted Markdown table, with input parameters defining the schema via type hints and docstring.
    async def get_funding_rate_history(
        symbol: str,
        startTime: Optional[int] = None,
        endTime: Optional[int] = None,
        limit: Optional[int] = None
    ) -> str:
        """
        Fetch Funding Rate History data from Aster Finance API and return as Markdown table text.
        
        Parameters:
            symbol (str): Trading pair symbol (e.g., 'BTCUSDT', 'ETHUSDT'). Case-insensitive.
            startTime (Optional[int]): Start time in milliseconds since Unix epoch. If None, defaults to API behavior.
            endTime (Optional[int]): End time in milliseconds since Unix epoch. If None, defaults to API behavior.
            limit (Optional[int]): Number of funding rate records to return (1 to 1000). If None, defaults to 100.
        
        Returns:
            str: Markdown table containing symbol, fundingTime, and fundingRate.
        
        Raises:
            Exception: If the API request fails or data processing encounters an error.
        """
        endpoint = "/fapi/v1/fundingRate"
        
        # Construct query parameters
        params = {
            "symbol": symbol.upper(),  # Ensure symbol is uppercase (e.g., BTCUSDT)
        }
        if startTime is not None:
            params["startTime"] = startTime
        if endTime is not None:
            params["endTime"] = endTime
        if limit is not None:
            params["limit"] = limit
    
        async with httpx.AsyncClient() as client:
            try:
                # Make GET request to the API
                response = await client.get(f"{BASE_URL}{endpoint}", params=params)
                response.raise_for_status()  # Raise exception for 4xx/5xx errors
                
                # Parse JSON response
                funding_data: List[dict] = response.json()
                
                # Create pandas DataFrame
                df = pd.DataFrame(funding_data)
                
                # Convert fundingTime to readable format
                df["fundingTime"] = pd.to_datetime(df["fundingTime"], unit="ms")
                
                # Select relevant columns and format numbers
                df = df[["symbol", "fundingTime", "fundingRate"]]
                df["fundingRate"] = df["fundingRate"].astype(float).round(8)
                
                # Convert DataFrame to Markdown table
                markdown_table = df.to_markdown(index=False)
                
                return markdown_table
            
            except httpx.HTTPStatusError as e:
                # Handle HTTP errors (e.g., 400, 429)
                raise Exception(f"API request failed: {e.response.status_code} - {e.response.text}")
            except Exception as e:
                # Handle other errors (e.g., network issues, pandas errors)
                raise Exception(f"Error processing Funding Rate data: {str(e)}")
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior: fetching data from a specific API (Aster Finance), returning formatted output (Markdown table), and handling errors (raises Exception on API failure). It also mentions default behaviors for optional parameters when None. However, it doesn't cover rate limits, authentication requirements, or data freshness.

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 well-structured and appropriately sized. It begins with the core purpose, then provides a clear parameter section with bullet-like formatting, followed by returns and raises sections. Every sentence adds value with no redundancy or fluff, making it easy to scan and understand.

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

Completeness4/5

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

Given no annotations and no output schema, the description does an excellent job covering parameters, return format, and error handling. However, for a financial data tool with 4 parameters, it could benefit from mentioning typical use cases, data latency, or rate limiting considerations to be fully complete for agent decision-making.

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?

The schema has 0% description coverage, so the description fully compensates by providing comprehensive parameter documentation. It explains each parameter's purpose, format (e.g., 'Trading pair symbol', 'milliseconds since Unix epoch'), constraints ('1 to 1000'), default behaviors, and examples ('BTCUSDT', 'ETHUSDT'). This adds significant value beyond the bare schema.

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 description clearly states the specific action ('Fetch Funding Rate History data') and resource ('from Aster Finance API'), distinguishing it from siblings like get_latest_price or get_order_book which serve different purposes. It specifies the exact data being retrieved (funding rate history) and the output format (Markdown table).

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool (to fetch funding rate history data), but doesn't explicitly mention when not to use it or name specific alternatives among the sibling tools. It distinguishes itself by focusing on funding rates rather than prices, trades, or order books, but lacks explicit comparison guidance.

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/kukapay/aster-info-mcp'

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