datetime_tool / tool.py
aneesarom's picture
Upload tool
6867117 verified
raw
history blame
578 Bytes
from smolagents import Tool
from typing import Any, Optional
class SimpleTool(Tool):
name = "get_today_datetime"
description = "Get the current local date and time."
inputs = {}
output_type = "null"
def forward(self):
"""
Get the current local date and time.
Returns:
str: Current date and time in the format 'YYYY-MM-DD HH:MM:SS'.
Example:
>>> forward()
'2025-08-29 15:42:18'
"""
from datetime import datetime
return datetime.now().strftime("%Y-%m-%d %H:%M:%S")