Skip to main content
Glama
kukapay

aster-info-mcp

get_latest_price

Fetch current cryptocurrency prices from Aster Finance API. Returns data as a Markdown table for specified or all trading pairs.

Instructions

Fetch latest price data 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 and price.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNo

Implementation Reference

  • main.py:438-491 (handler)
    The main handler function for the 'get_latest_price' tool. It fetches the latest price data from the Aster Finance API (/fapi/v1/ticker/price), processes it using pandas into a DataFrame, formats the price to 8 decimal places, and returns it as a Markdown table. Supports optional symbol parameter; if none, returns all symbols. Includes type hints for input/output and comprehensive error handling.
    async def get_latest_price(
        symbol: Optional[str] = None
    ) -> str:
        """
        Fetch latest price data 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 and price.
        
        Raises:
            Exception: If the API request fails or data processing encounters an error.
        """
        endpoint = "/fapi/v1/ticker/price"
        
        # 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
                price_data = response.json()
                
                # Handle single symbol (dict) or all symbols (list of dicts)
                if isinstance(price_data, dict):
                    price_data = [price_data]
                
                # Create pandas DataFrame
                df = pd.DataFrame(price_data)
                
                # Select relevant columns and format numbers
                df = df[["symbol", "price"]]
                df["price"] = df["price"].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 latest price data: {str(e)}")            
  • main.py:438-438 (registration)
    The @mcp.tool() decorator registers the get_latest_price function as an MCP tool in the FastMCP server.
    async def get_latest_price(
  • Function signature providing type hints: accepts optional symbol (str) and returns str (Markdown table). Docstring details parameters, return value, and exceptions.
        symbol: Optional[str] = None
    ) -> str:
Behavior3/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 mentions the API source and error conditions ('Raises: Exception'), which is helpful. However, it doesn't disclose important behavioral traits like rate limits, authentication requirements, response time expectations, or what happens when the symbol parameter is null (though this is covered in parameter semantics).

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 clear sections (purpose, parameters, returns, raises). Every sentence earns its place by providing essential information. The front-loaded purpose statement immediately communicates the tool's function without unnecessary preamble.

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 single-parameter tool with no annotations and no output schema, the description provides good coverage of purpose, parameters, and basic error handling. It could be more complete by explaining the structure of the returned Markdown table or providing more detail about error conditions, but it's substantially complete for this level of 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 schema description coverage is 0%, so the description must fully compensate. It provides excellent parameter semantics: explains the symbol parameter is optional, provides examples ('BTCUSDT', 'ETHUSDT'), specifies case-insensitivity, and clearly states the behavior when None (returns data for all symbols). This adds substantial value beyond what the bare schema provides.

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 latest price data'), source ('from Aster Finance API'), and output format ('return as Markdown table text'). It distinguishes this tool from its siblings by focusing specifically on price data rather than trades, order books, or other market metrics.

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 about when to use this tool (for fetching price data) and implicitly distinguishes it from siblings that handle different data types like trades, order books, or statistics. However, it doesn't explicitly state when NOT to use it or name specific alternative tools for related purposes.

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