get_mini_24hr
Retrieve real-time 24-hour mini ticker data for cryptocurrency trading pairs using the symbol parameter. Supports individual symbols like BTCUSDT or fetches all pairs if unspecified. Ideal for monitoring market trends.
Instructions
Get 24-hour mini ticker info, supports symbol parameter
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | Trading pair symbol in format like BTCUSDT, ETHUSDT, etc. Leave empty to get all symbols. |
Implementation Reference
- src/desk3_service/server.py:67-80 (handler)Primary handler function that implements the core logic for the get_mini_24hr tool by making an API request to the Desk3 market mini/24hr endpoint.async def get_mini_24hr(symbol: str | None = None) -> list[dict[str, Any]]: """ Get 24-hour mini ticker information. :param symbol: Trading pair, comma separated for multiple, return all if not provided :return: Mini ticker info array """ url = 'https://mcp.desk3.io/v1/market/mini/24hr' params = {} if symbol: params['symbol'] = symbol try: return request_api('get', url, params=params) except Exception as e: raise RuntimeError(f"Failed to fetch mini 24hr data: {e}")
- src/desk3_service/server.py:546-557 (schema)JSON schema defining the input parameters for the get_mini_24hr tool (optional 'symbol' string).inputSchema={ "type": "object", "properties": { "symbol": { "type": "string", "description": "Trading pair symbol in format like BTCUSDT, ETHUSDT, etc. Leave empty to get all symbols.", "examples": ["BTCUSDT", "ETHUSDT", "BNBUSDT"], "pattern": "^[A-Z0-9]+$" }, }, "required": [], },
- src/desk3_service/server.py:543-557 (registration)Registration of the get_mini_24hr tool in the server's list_tools() handler, specifying name, description, and input schema.types.Tool( name="get_mini_24hr", description="Get 24-hour mini ticker info, supports symbol parameter", inputSchema={ "type": "object", "properties": { "symbol": { "type": "string", "description": "Trading pair symbol in format like BTCUSDT, ETHUSDT, etc. Leave empty to get all symbols.", "examples": ["BTCUSDT", "ETHUSDT", "BNBUSDT"], "pattern": "^[A-Z0-9]+$" }, }, "required": [], },
- src/desk3_service/server.py:735-746 (handler)MCP protocol handler in server.call_tool() that dispatches calls to get_mini_24hr and formats the JSON response.case "get_mini_24hr": symbol = arguments.get("symbol") if arguments else None try: data = await get_mini_24hr(symbol=symbol) return [ types.TextContent( type="text", text=json.dumps(data, indent=2), ) ] except Exception as e: raise RuntimeError(f"Failed to fetch mini 24hr data: {e}")
- src/desk3_service/server.py:23-42 (helper)Shared helper function used by get_mini_24hr (and other tools) to make authenticated HTTP requests to the Desk3 API.def request_api(method: str, url: str, params: dict = None, data: dict = None) -> any: headers = { 'Accepts': 'application/json', 'X-DESK3_PRO_API_KEY': API_KEY, } try: logging.info(f"Requesting {method.upper()} {url} params={params} data={data}") if method.lower() == 'get': response = requests.get(url, headers=headers, params=params) elif method.lower() == 'post': response = requests.post(url, headers=headers, json=data) else: raise ValueError(f"Unsupported HTTP method: {method}") response.raise_for_status() logging.info(f"Response {response.status_code} for {url}") return json.loads(response.text) except Exception as e: logging.error(f"Error during {method.upper()} {url}: {e}") raise