get-market-summary
Retrieve detailed market summary data for cryptocurrency trading pairs from major exchanges to analyze current market conditions and trading information.
Instructions
Get detailed market summary for a cryptocurrency pair from a specific exchange
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Trading pair symbol (e.g., BTC/USDT, ETH/USDT) | |
| exchange | No | Exchange to use (supported: binance, coinbase, kraken, kucoin, hyperliquid, huobi, bitfinex, bybit, okx, mexc) | binance |
Implementation Reference
- src/server.py:253-263 (handler)The handler executes the 'get-market-summary' tool by fetching the ticker data from the specified exchange using ccxt and formatting it with the format_ticker helper.elif name == "get-market-summary": symbol = arguments.get("symbol", "").upper() ticker = await exchange.fetch_ticker(symbol) formatted_data = await format_ticker(ticker, exchange_id) return [ types.TextContent( type="text", text=f"Market summary for {symbol}:\n\n{formatted_data}" ) ]
- src/server.py:120-134 (registration)The tool registration in list_tools(), including name, description, and input schema.types.Tool( name="get-market-summary", description="Get detailed market summary for a cryptocurrency pair from a specific exchange", inputSchema={ "type": "object", "properties": { "symbol": { "type": "string", "description": "Trading pair symbol (e.g., BTC/USDT, ETH/USDT)", }, "exchange": get_exchange_schema() }, "required": ["symbol"], }, ),
- src/server.py:59-66 (schema)Schema definition for the exchange parameter, referenced in the tool's inputSchema.def get_exchange_schema() -> Dict[str, Any]: """Get the JSON schema for exchange selection.""" return { "type": "string", "description": f"Exchange to use (supported: {', '.join(SUPPORTED_EXCHANGES.keys())})", "enum": list(SUPPORTED_EXCHANGES.keys()), "default": "binance" }
- src/server.py:44-56 (helper)Helper function to format the ticker data into a human-readable market summary string.async def format_ticker(ticker: Dict[str, Any], exchange_id: str) -> str: """Format ticker data into a readable string.""" return ( f"Exchange: {exchange_id.upper()}\n" f"Symbol: {ticker.get('symbol')}\n" f"Last Price: {ticker.get('last', 'N/A')}\n" f"24h High: {ticker.get('high', 'N/A')}\n" f"24h Low: {ticker.get('low', 'N/A')}\n" f"24h Volume: {ticker.get('baseVolume', 'N/A')}\n" f"Bid: {ticker.get('bid', 'N/A')}\n" f"Ask: {ticker.get('ask', 'N/A')}\n" "---" )
- src/server.py:31-42 (helper)Helper to retrieve or initialize the ccxt exchange instance, used in the handler.async def get_exchange(exchange_id: str) -> ccxt.Exchange: """Get or create an exchange instance.""" exchange_id = exchange_id.lower() if exchange_id not in SUPPORTED_EXCHANGES: raise ValueError(f"Unsupported exchange: {exchange_id}") if exchange_id not in exchange_instances: exchange_class = SUPPORTED_EXCHANGES[exchange_id] exchange_instances[exchange_id] = exchange_class() return exchange_instances[exchange_id]