Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

LLMs need explicit, actionable guidance on when to check current date before calendar operations. Without this, they use stale date information, leading to incorrect queries like "show me today's events" when "today" refers to an outdated timestamp.

Changes

Enhanced calendar_current_context tool documentation

  • Added explicit WHEN/WHY guidance (call at conversation start, before queries, before event creation)
  • Documented 5-minute validity window
  • Added prerequisite warnings to calendar_get_events, calendar_create_event, calendar_create_task

Improved context output structure

  • Added visual hierarchy with headers and separators
  • Included "Yesterday" and more granular anchors (day after tomorrow, next weekend, in 2 weeks)
  • Next weekend now dynamically calculated to always point to next Saturday
  • Provided concrete usage examples with exact ISO dates

Strengthened guard messages

  • Changed from passive "Confirm the current date" to actionable "⚠️ REQUIRED: Call calendar_current_context first"
  • Explained consequences and resolution steps

Example

Before:

Current date: 2025-11-03 (Monday)
Upcoming anchors:
- Tomorrow: 2025-11-04 (Tuesday)
- Next week: 2025-11-10 (Monday)

After:

============================================================
CURRENT DATE AND TIME CONTEXT
============================================================

Today: 2025-11-03 (Monday)
Yesterday: 2025-11-02 (Sunday)

Upcoming date anchors (for calendar queries):
  • Tomorrow: 2025-11-04 (Tuesday)
  • Day after tomorrow: 2025-11-05 (Wednesday)
  • Next weekend: 2025-11-08 (Saturday)
  • Next week (7 days): 2025-11-10 (Monday)

============================================================

✓ Context refreshed and valid for the next 5 minutes.

IMPORTANT: Use the exact ISO dates shown above when constructing 
calendar queries. For example:
- To find today's events: use time_min='2025-11-03'
- To find tomorrow's events: use time_min='2025-11-04'

Files Modified

  • src/backend/mcp_servers/calendar_server.py - Tool descriptions and guard logic
  • src/backend/services/time_context.py - Context formatting and anchor calculation
  • tests/test_calendar_server.py - Updated assertions for new messages
Original prompt

ok lets do it

Conversation Summary

Context:

  • The current date is November 2, 2025.
  • The user is working on a file located at /home/human/REPOS/Backend_FastAPI/src/backend/mcp_servers/calendar_server.py.
  • The repository is named Backend_FastAPI, owned by jck411, and the current branch is master, which is also the default branch.

Recent Agent Commands/Tools Executed:

  • The user issued a command stating, "ok lets do it," indicating readiness to proceed with a task or operation related to the current file or repository.

Results from Recent Tool Calls:

  • No specific tool calls were executed that returned results, as the user’s command was more of an affirmation rather than a request for information or action.

Active Work When Token Budget Exceeded:

  • The agent was prepared to assist the user with tasks related to the calendar_server.py file in the context of the Backend_FastAPI repository. However, no specific operations were detailed in the recent interactions.

Connection to Overall User Goals:

  • The user's statement suggests a desire to engage in further development or modifications within the calendar_server.py file, likely aiming to enhance functionality or address issues within the FastAPI backend framework. The readiness to proceed indicates a collaborative effort to achieve specific programming objectives.
    TITLE: Improving calendar date context handling in LLM

Created from VS Code via the GitHub Pull Request extension.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 3, 2025
Copilot AI and others added 2 commits November 3, 2025 02:24
- Enhanced calendar_current_context tool with comprehensive documentation explaining WHEN and WHY to use it
- Improved context output formatting with clear sections and visual separators
- Added more helpful date anchors (yesterday, day after tomorrow, this weekend, in 2 weeks)
- Provided concrete examples showing how to use ISO dates from context in queries
- Strengthened context guard messages to be more actionable and explanatory
- Updated tool descriptions to emphasize prerequisite of calling calendar_current_context first
- Added warnings and best practice notes to get_events, create_event, and create_task tools
- Updated test expectations to match improved error messages

Co-authored-by: jck411 <81551487+jck411@users.noreply.github.com>
- Fix datetime import usage to use 'dt' alias consistently
- Calculate next weekend (Saturday) dynamically based on current day instead of fixed offset
- Remove trailing whitespace

Co-authored-by: jck411 <81551487+jck411@users.noreply.github.com>
Copilot AI changed the title [WIP] Improving calendar date context handling in LLM Improve calendar date context handling for LLM interactions Nov 3, 2025
Copilot AI requested a review from jck411 November 3, 2025 02:32
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.

2 participants