Skip to main content
Glama
kukapay

aster-info-mcp

get_order_book_ticker

Fetch real-time order book ticker data for trading pairs from Aster Finance API and display as Markdown tables showing bid/ask prices and quantities.

Instructions

Fetch order book ticker 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, bidPrice, bidQty, askPrice, and askQty.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNo

Implementation Reference

  • main.py:494-551 (handler)
    Handler function for the 'get_order_book_ticker' tool. Fetches best bid/ask prices and quantities from Aster Finance API (/fapi/v1/ticker/bookTicker), processes with pandas DataFrame, formats to Markdown table. Also serves as registration via @mcp.tool() decorator. Input schema via type hints and docstring.
    @mcp.tool()
    async def get_order_book_ticker(
        symbol: Optional[str] = None
    ) -> str:
        """
        Fetch order book ticker 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, bidPrice, bidQty, askPrice, and askQty.
        
        Raises:
            Exception: If the API request fails or data processing encounters an error.
        """
        endpoint = "/fapi/v1/ticker/bookTicker"
        
        # 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", "bidPrice", "bidQty", "askPrice", "askQty"]]
                df["bidPrice"] = df["bidPrice"].astype(float).round(8)
                df["bidQty"] = df["bidQty"].astype(float).round(8)
                df["askPrice"] = df["askPrice"].astype(float).round(8)
                df["askQty"] = df["askQty"].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 order book ticker 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 full burden and does well by disclosing: the data source (Aster Finance API), output format (Markdown table), specific fields returned, error conditions (API request failures or data processing errors), and parameter behavior (case-insensitive symbol, optional with default). It doesn't mention 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.

Conciseness5/5

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

Perfectly structured with clear sections: purpose statement, parameters explanation, returns specification, and error conditions. Every sentence earns its place with no redundancy. The description is appropriately sized for a single-parameter tool with rich behavioral context.

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 1 parameter, 0% schema coverage, no annotations, and no output schema, the description provides excellent coverage: purpose, parameters, returns, and errors. It doesn't explain the structure of the Markdown table or provide example output, but given the tool's relative simplicity, this is a minor gap.

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 must fully compensate. It provides excellent parameter semantics: explains the symbol parameter is optional, provides examples ('BTCUSDT', 'ETHUSDT'), specifies case-insensitivity, and clarifies the behavior when None (returns data for all symbols). This adds substantial meaning 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 order book ticker data'), source ('from Aster Finance API'), and output format ('return as Markdown table text'). It distinguishes this tool from siblings by focusing on order book ticker data rather than trades, prices, 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 Guidelines3/5

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

The description implies usage through the parameter explanation (fetch data for a specific symbol or all symbols), but doesn't explicitly state when to use this tool versus alternatives like get_order_book (which might provide full depth data) or get_latest_price (which provides different price information). No explicit guidance on use cases 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