MCPcopy Create free account
hub / github.com/google/adk-samples / get_current_time

Function get_current_time

python/agents/memory-bank/app/agent.py:40–56  ·  view source on GitHub ↗

Simulates getting the current time for a city. Args: query: The name of the city to get the current time for. Returns: A string with the current time information.

(query: str)

Source from the content-addressed store, hash-verified

38
39
40def get_current_time(query: str) -> str:
41 """Simulates getting the current time for a city.
42
43 Args:
44 query: The name of the city to get the current time for.
45
46 Returns:
47 A string with the current time information.
48 """
49 if "sf" in query.lower() or "san francisco" in query.lower():
50 tz_identifier = "America/Los_Angeles"
51 else:
52 return f"Sorry, I don't have timezone information for query: {query}."
53
54 tz = ZoneInfo(tz_identifier)
55 now = datetime.datetime.now(tz)
56 return f"The current time for query {query} is {now.strftime('%Y-%m-%d %H:%M:%S %Z%z')}"
57
58
59# --- Memory Bank ---

Callers 2

test_get_current_time_sfFunction · 0.90

Calls

no outgoing calls

Tested by 2

test_get_current_time_sfFunction · 0.72