get_current_time
Retrieve current system time and A-share trading day information to verify date parameters before using other financial analysis tools.
Instructions
获取当前系统时间及A股交易日信息,建议在调用其他需要日期参数的工具前使用该工具
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp_aktools/__init__.py:209-227 (handler)Full implementation of the get_current_time tool handler, decorated with @mcp.tool for registration. Returns current time and recent A-share trading days.@mcp.tool( title="获取当前时间及A股交易日信息", description="获取当前系统时间及A股交易日信息,建议在调用其他需要日期参数的工具前使用该工具", ) def get_current_time(): now = datetime.now() week = "日一二三四五六日"[now.isoweekday()] texts = [f"当前时间: {now.isoformat()}, 星期{week}"] dfs = ak_cache(ak.tool_trade_date_hist_sina, ttl=43200) if dfs is not None: start = now.date() - timedelta(days=5) ended = now.date() + timedelta(days=5) dates = [ d.strftime("%Y-%m-%d") for d in dfs["trade_date"] if start <= d <= ended ] texts.append(f", 最近交易日有: {','.join(dates)}") return "".join(texts)