get_instruments_info
Retrieve detailed exchange instrument information, including category, symbol, status, and base coin, directly from Bybit API to analyze market data and execute trades efficiently.
Instructions
Get exchange information
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
status (Optional[str]): Status
baseCoin (Optional[str]): Base coin
Returns:
Dict: Exchange information
Example:
get_instruments_info("spot", "BTCUSDT", "Trading", "BTC")
Reference:
https://bybit-exchange.github.io/docs/v5/market/instrument
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| baseCoin | No | Base coin | |
| category | Yes | Category (spot, linear, inverse, etc.) | |
| status | No | Status | |
| symbol | Yes | Symbol (e.g., BTCUSDT) |
Implementation Reference
- src/server.py:591-625 (handler)The primary MCP tool handler for 'get_instruments_info'. Registered via @mcp.tool(), defines input schema using Pydantic Field descriptions, implements logic by calling BybitService helper with error handling and logging.@mcp.tool() def get_instruments_info( category: str = Field(description="Category (spot, linear, inverse, etc.)"), symbol: str = Field(description="Symbol (e.g., BTCUSDT)"), status: Optional[str] = Field(default=None, description="Status"), baseCoin: Optional[str] = Field(default=None, description="Base coin") ) -> Dict: """ Get exchange information Args: category (str): Category (spot, linear, inverse, etc.) symbol (str): Symbol (e.g., BTCUSDT) status (Optional[str]): Status baseCoin (Optional[str]): Base coin Returns: Dict: Exchange information Example: get_instruments_info("spot", "BTCUSDT", "Trading", "BTC") Reference: https://bybit-exchange.github.io/docs/v5/market/instrument """ try: result = bybit_service.get_instruments_info(category, symbol, status, baseCoin) if result.get("retCode") != 0: logger.error(f"Failed to get instruments information: {result.get('retMsg')}") return {"error": result.get("retMsg")} return result except Exception as e: logger.error(f"Failed to get instruments information: {e}", exc_info=True) return {"error": str(e)}
- src/service.py:489-508 (helper)Supporting helper method in BybitService class that directly delegates to the underlying pybit.unified_trading.HTTP client's get_instruments_info method.def get_instruments_info(self, category: str, symbol: str, status: Optional[str] = None, baseCoin: Optional[str] = None) -> Dict: """ Get exchange information Args: category (str): Category (spot, linear, inverse, etc.) symbol (str): Symbol (e.g., BTCUSDT) status (Optional[str]): Status baseCoin (Optional[str]): Base coin Returns: Dict: Exchange information """ return self.client.get_instruments_info( category=category, symbol=symbol, status=status, baseCoin=baseCoin )