Make get time tool use system tool
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import asyncio
|
||||
import ast
|
||||
import operator
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict
|
||||
|
||||
import aiohttp
|
||||
@@ -241,7 +242,21 @@ async def execute_server_tool(tool_call: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"status": {"code": 422, "message": "invalid_code"},
|
||||
}
|
||||
|
||||
if tool_name and tool_name not in {"calculator", "code_interpreter"}:
|
||||
if tool_name == "current_time":
|
||||
now = datetime.now().astimezone()
|
||||
return {
|
||||
"tool_call_id": call_id,
|
||||
"name": tool_name,
|
||||
"output": {
|
||||
"local_time": now.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"iso": now.isoformat(),
|
||||
"timezone": str(now.tzinfo or ""),
|
||||
"timestamp": int(now.timestamp()),
|
||||
},
|
||||
"status": {"code": 200, "message": "ok"},
|
||||
}
|
||||
|
||||
if tool_name and tool_name not in {"calculator", "code_interpreter", "current_time"}:
|
||||
resource = await fetch_tool_resource(tool_name)
|
||||
if resource and str(resource.get("category") or "") == "query":
|
||||
method = str(resource.get("http_method") or "GET").strip().upper()
|
||||
|
||||
Reference in New Issue
Block a user