get_mini_24hr
Retrieve 24-hour cryptocurrency ticker data for specific trading pairs or all symbols to monitor market performance and price changes.
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)The main handler function that fetches 24-hour mini ticker information by making an API request to the Desk3 endpoint, handling optional symbol parameter.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:543-557 (registration)Registration of the 'get_mini_24hr' tool in the MCP server's list_tools handler, including description and JSON schema for input validation.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:546-556 (schema)Input schema definition for the 'get_mini_24hr' tool, specifying optional 'symbol' parameter with validation rules.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-745 (registration)Tool execution dispatcher case in the MCP server's call_tool handler that invokes the get_mini_24hr function and formats the 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:
- src/desk3_service/server.py:23-41 (helper)Shared helper function used by get_mini_24hr to perform authenticated API requests to Desk3 endpoints.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