Files
portainer-core/services
jpmschweitzerandClaude 29ad606c36 feat(ai): add timezone-aware time tool with comprehensive testing
Problem:
- Model was hallucinating time answers (e.g., wrong Amsterdam time)
- get_current_time() only returned UTC
- No way to query time in specific timezones

Solution:
- Enhanced get_current_time(timezone) to support any IANA timezone
- Added pytz>=2025.2 dependency for timezone handling
- Returns formatted time with timezone info: "2025-11-30 16:25:55 CET"
- Supports timezones: Europe/Amsterdam, America/New_York, Asia/Tokyo, etc.

Testing:
- Added test_timezone.py: 6 comprehensive timezone tests
  - UTC, Amsterdam, New York, Tokyo timezone queries
  - Invalid timezone error handling
  - Timezone offset correctness validation
- Added test_agent_timezone.py: 3 integration tests
  - Agent tool usage for timezone queries
  - Agent behavior with/without tools
  - Multi-timezone query handling

All new tests passing. Tool verified working across multiple timezones.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 16:42:57 +01:00
..
2025-11-30 11:42:38 +01:00