Skip to main content
Glama
kukapay

aster-info-mcp

get_latest_price

Fetch real-time price data from Aster Finance API for specified trading pairs, returning results in a clear Markdown table format. Ideal for quick market insights.

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 from the Aster Finance API (/fapi/v1/ticker/price), handles single or multiple symbols, processes the data using pandas into a Markdown table, and includes error handling. The @mcp.tool() decorator registers it as an MCP tool.
    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.
    async def get_latest_price(

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