Skip to main content
Glama
kukapay

aster-info-mcp

get_price_change_statistics_24h

Fetch 24-hour cryptocurrency price change statistics from Aster Finance API and display as a Markdown table with symbol, price change, percentage change, last price, and volume.

Instructions

Fetch 24-hour ticker price change statistics from Aster Finance API and return as Markdown table text.

Parameters:
    symbol (Optional[str]): Trading pair symbol (e.g., 'BTCUSDT', 'ETHUSDT'). Case-insensitive.
                           If None, returns data for all symbols.

Returns:
    str: Markdown table containing symbol, priceChange, priceChangePercent, lastPrice, and volume.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNo

Implementation Reference

  • main.py:377-434 (handler)
    The handler function for the 'get_price_change_statistics_24h' tool. It is registered via the @mcp.tool() decorator. Fetches 24hr ticker statistics from Asterdex API, processes with pandas DataFrame, formats numbers, and returns a Markdown table.
    @mcp.tool()
    async def get_price_change_statistics_24h(
        symbol: Optional[str] = None
    ) -> str:
        """
        Fetch 24-hour ticker price change statistics from Aster Finance API and return as Markdown table text.
        
        Parameters:
            symbol (Optional[str]): Trading pair symbol (e.g., 'BTCUSDT', 'ETHUSDT'). Case-insensitive.
                                   If None, returns data for all symbols.
        
        Returns:
            str: Markdown table containing symbol, priceChange, priceChangePercent, lastPrice, and volume.
        
        Raises:
            Exception: If the API request fails or data processing encounters an error.
        """
        endpoint = "/fapi/v1/ticker/24hr"
        
        # Construct query parameters
        params = {}
        if symbol is not None:
            params["symbol"] = symbol.upper()  # Ensure symbol is uppercase (e.g., BTCUSDT)
    
        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
                ticker_data = response.json()
                
                # Handle single symbol (dict) or all symbols (list of dicts)
                if isinstance(ticker_data, dict):
                    ticker_data = [ticker_data]
                
                # Create pandas DataFrame
                df = pd.DataFrame(ticker_data)
                
                # Select relevant columns and format numbers
                df = df[["symbol", "priceChange", "priceChangePercent", "lastPrice", "volume"]]
                df["priceChange"] = df["priceChange"].astype(float).round(8)
                df["priceChangePercent"] = df["priceChangePercent"].astype(float).round(2)
                df["lastPrice"] = df["lastPrice"].astype(float).round(8)
                df["volume"] = df["volume"].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 24-hour price change statistics: {str(e)}")      
  • main.py:377-377 (registration)
    The @mcp.tool() decorator registers the get_price_change_statistics_24h function as an MCP tool.
    @mcp.tool()
  • The function signature and docstring define the input schema (symbol: Optional[str]) and output (str Markdown table).
    async def get_price_change_statistics_24h(
        symbol: Optional[str] = None
    ) -> str:
        """
        Fetch 24-hour ticker price change statistics from Aster Finance API and return as Markdown table text.
        
        Parameters:
            symbol (Optional[str]): Trading pair symbol (e.g., 'BTCUSDT', 'ETHUSDT'). Case-insensitive.
                                   If None, returns data for all symbols.
        
        Returns:
            str: Markdown table containing symbol, priceChange, priceChangePercent, lastPrice, and volume.
        
        Raises:
            Exception: If the API request fails or data processing encounters an error.
        """
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 and does well by disclosing the return format (Markdown table), specific fields included, error behavior (raises Exception on API failure), and the case-insensitive nature of the symbol parameter. It doesn't mention rate limits, authentication needs, or data freshness, leaving some gaps.

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 efficiently structured with a clear purpose statement followed by organized sections for Parameters, Returns, and Raises. Each sentence adds value without redundancy, making it easy to scan and understand quickly.

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 no annotations, no output schema, and low schema coverage, the description does an excellent job covering purpose, parameters, return format, and error handling. It could improve by mentioning data latency or API-specific constraints, but it's largely complete for the given complexity.

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 description adds significant meaning beyond the input schema, which has 0% description coverage. It explains the symbol parameter's purpose (trading pair), provides examples ('BTCUSDT', 'ETHUSDT'), clarifies case-insensitivity, and describes the effect when None (returns all symbols). This fully compensates for the schema's lack of documentation.

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 verb 'fetch' and the resource '24-hour ticker price change statistics from Aster Finance API', specifying the exact data source and time frame. It distinguishes from siblings by focusing on price change statistics rather than trades, klines, order books, or other market data types.

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 get 24-hour price change statistics) but doesn't explicitly mention when not to use it or name specific alternatives among the sibling tools. The parameter description implies usage for single symbols vs. all symbols, which offers some 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