Files changed (1) hide show
  1. tools/Current time +13 -0
tools/Current time ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def get_current_time_in_timezone(timezone: str) -> str:
2
+ """A tool that fetches the current local time in a specified timezone.
3
+ Args:
4
+ timezone: A string representing a valid timezone (e.g., 'America/New_York').
5
+ """
6
+ try:
7
+ # Create timezone object
8
+ tz = pytz.timezone(timezone)
9
+ # Get current time in that timezone
10
+ local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
11
+ return f"The current local time in {timezone} is: {local_time}"
12
+ except Exception as e:
13
+ return f"Error fetching time for timezone '{timezone}': {str(e)}"