Skip to main content
Glama
kukapay

aster-info-mcp

get_mark_price_kline

Fetch mark price candlestick data for trading pairs from Aster Finance API and return as formatted Markdown tables for analysis.

Instructions

Fetch Mark Price Kline/Candlestick data from Aster Finance API and return as Markdown table text.

Parameters:
    symbol (str): Trading pair symbol (e.g., 'BTCUSDT', 'ETHUSDT'). Case-insensitive.
    interval (str): Kline interval (e.g., '1m' for 1 minute, '1h' for 1 hour, '1d' for 1 day).
    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 Klines to return (1 to 1500). If None, defaults to 500.

Returns:
    str: Markdown table containing open_time, open, high, low, and close.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
intervalYes
startTimeNo
endTimeNo
limitNo

Implementation Reference

  • main.py:172-245 (handler)
    The handler function decorated with @mcp.tool() that implements the get_mark_price_kline tool. It fetches Mark Price Kline data from the Aster Finance API (/fapi/v1/markPriceKlines), processes it into a pandas DataFrame, formats it, and returns a Markdown table.
    @mcp.tool()
    async def get_mark_price_kline(
        symbol: str,
        interval: str,
        startTime: Optional[int] = None,
        endTime: Optional[int] = None,
        limit: Optional[int] = None
    ) -> str:
        """
        Fetch Mark Price Kline/Candlestick data from Aster Finance API and return as Markdown table text.
        
        Parameters:
            symbol (str): Trading pair symbol (e.g., 'BTCUSDT', 'ETHUSDT'). Case-insensitive.
            interval (str): Kline interval (e.g., '1m' for 1 minute, '1h' for 1 hour, '1d' for 1 day).
            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 Klines to return (1 to 1500). If None, defaults to 500.
        
        Returns:
            str: Markdown table containing open_time, open, high, low, and close.
        
        Raises:
            Exception: If the API request fails or data processing encounters an error.
        """
        endpoint = "/fapi/v1/markPriceKlines"
        
        # Construct query parameters
        params = {
            "symbol": symbol.upper(),  # Ensure symbol is uppercase (e.g., BTCUSDT)
            "interval": interval,      # e.g., 1m, 1h, 1d
        }
        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
                kline_data: List[List[Any]] = response.json()
                
                # Create pandas DataFrame
                df = pd.DataFrame(kline_data, columns=[
                    "open_time", "open", "high", "low", "close", "volume",
                    "close_time", "ignore1", "ignore2", "ignore3", "ignore4", "ignore5"
                ])
                
                # Convert timestamps to readable format
                df["open_time"] = pd.to_datetime(df["open_time"], unit="ms")
                
                # Select relevant columns and format numbers
                df = df[["open_time", "open", "high", "low", "close"]]
                df["open"] = df["open"].astype(float).round(8)
                df["high"] = df["high"].astype(float).round(8)
                df["low"] = df["low"].astype(float).round(8)
                df["close"] = df["close"].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 Mark Price Kline data: {str(e)}")            
  • main.py:172-172 (registration)
    The @mcp.tool() decorator registers the get_mark_price_kline function as an MCP tool.
    @mcp.tool()
  • Function signature defines the input schema (parameters with types) and output type for the tool, used by FastMCP for validation.
    async def get_mark_price_kline(
        symbol: str,
        interval: str,
        startTime: Optional[int] = None,
        endTime: Optional[int] = None,
        limit: Optional[int] = None
    ) -> str:
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing: the tool fetches from an external API (Aster Finance), returns data in Markdown table format, includes error handling ('Raises: Exception'), and specifies default behaviors for optional parameters. It lacks details on rate limits, authentication needs, 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.

Conciseness4/5

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

The description is well-structured with clear sections (purpose, parameters, returns, raises) and uses bullet points for readability. It is appropriately sized but could be slightly more concise by integrating the purpose statement with parameter details.

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?

For a tool with 5 parameters, no annotations, and no output schema, the description is quite complete: it covers purpose, all parameters with semantics, return format, and error handling. It lacks sibling differentiation and some behavioral details (e.g., rate limits), but overall provides sufficient context for effective use.

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?

Schema description coverage is 0%, so the description fully compensates by providing clear semantics for all 5 parameters: explains each parameter's purpose, gives examples (e.g., 'BTCUSDT', '1m'), specifies optional/default behaviors, and defines valid ranges (e.g., 'limit' from 1 to 1500). 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 Mark Price Kline/Candlestick data'), resource ('from Aster Finance API'), and output format ('return as Markdown table text'). It distinguishes this tool from siblings like 'get_kline' (likely spot price) and 'get_index_price_kline' by specifying 'Mark Price' data.

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 through parameter explanations (e.g., 'symbol' for trading pairs, 'interval' for timeframes) but does not explicitly state when to use this tool versus alternatives like 'get_kline' or 'get_index_price_kline'. No guidance on prerequisites or exclusions is provided.

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