Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds date calculation capabilities to the MCP time server with two new tools for performing date arithmetic and determining days of the week.
Description
This PR enhances the time server with date operation functionality through two new tools:
calculate_date
: Performs date arithmetic by adding or subtracting days from a given dateget_day_of_week
: Determines the day of the week for any given dateBoth tools support multiple date formats (YYYY-MM-DD, Month DD YYYY, MM/DD/YYYY, etc.) and provide clear error messages with format hints when parsing fails.
Server Details
Motivation and Context
LLMs often struggle with date arithmetic, leading to calculation errors and hallucinations when asked, "What date is 5 days from today?" This PR addresses this by providing deterministic, mathematically accurate date calculations.
Previously, the time server only handled current time and timezone conversions. These new tools enable:
hallucination risks
confidence
"remind me in 10 days")
Example: Instead of an LLM guessing that "today + 5 days = May 30, 2025", it now receives a verified calculation with day-of-week confirmation (Friday), eliminating common errors like incorrect month transitions or leap year mistakes.
Also fixes a bug where
McpError
was incorrectly initialized with a string instead of anErrorData
object.How Has This Been Tested?
Breaking Changes
No breaking changes. This is a non-breaking addition of new functionality.
Types of changes
Checklist
Additional context
DateCalculationResult
includes acalculation_details
field that provides human-readable feedback about what operation was performed