Skip to content

feat(time): default to configured timezone when omitted#3740

Open
Christian-Sidak wants to merge 1 commit intomodelcontextprotocol:mainfrom
Christian-Sidak:feat-time-default-timezone
Open

feat(time): default to configured timezone when omitted#3740
Christian-Sidak wants to merge 1 commit intomodelcontextprotocol:mainfrom
Christian-Sidak:feat-time-default-timezone

Conversation

@Christian-Sidak
Copy link
Copy Markdown

Summary

When --local-timezone is configured, the time server currently only uses it as a hint in the tool description, hoping the LLM will pass it explicitly. If the LLM omits the timezone argument, the call fails with "Missing required argument."

This PR makes the configured timezone an actual default:

  • get_current_time: timezone is now optional. Defaults to local_tz when not provided.
  • convert_time: source_timezone and target_timezone are now optional, both defaulting to local_tz. Only time remains required.
  • Tool descriptions updated to say "Defaults to X if not provided" instead of "Use X as local timezone if no timezone provided by the user."

This means a user can say "what time is it?" and the LLM can call get_current_time with no arguments, getting the local time. Previously this would error.

Fixes #2853

Test plan

  • All 38 existing tests pass (no regressions)
  • 3 new tests for default timezone behavior:
    • get_current_time with no timezone uses local_tz
    • convert_time with no source_timezone uses local_tz
    • convert_time with no target_timezone uses local_tz
  • 41/41 tests pass total

When --local-timezone is configured, the timezone parameters in
get_current_time and convert_time now default to the local timezone
instead of raising an error. This means LLMs no longer need to
explicitly pass the timezone on every call.

- get_current_time: timezone is now optional, defaults to local_tz
- convert_time: source_timezone and target_timezone are optional,
  default to local_tz. Only time remains required.
- Updated tool descriptions to reflect the default behavior

Fixes modelcontextprotocol#2853
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp-server-time: Default Time Zone

2 participants