Skip to content

Add day-of-week validation for task dates#15

Open
partymola wants to merge 1 commit into
jen6:mainfrom
partymola:feature/day-of-week-validation
Open

Add day-of-week validation for task dates#15
partymola wants to merge 1 commit into
jen6:mainfrom
partymola:feature/day-of-week-validation

Conversation

@partymola

Copy link
Copy Markdown

When dueDate is set on create_task or update_task, the caller must also pass expectedDayOfWeek (e.g. "Monday"). The server validates the date actually falls on that day and returns an error on mismatch.

Why

LLM agents sometimes say "Monday" but pass a date that is actually a Tuesday. This cross-check catches the inconsistency before the task is created.

Details

  • Validates in the task's timeZone when provided, so late-night UTC dates resolve to the correct local day
  • Error messages include the timezone used: "2026-04-14 is Tuesday in Europe/London, not Monday"
  • Hardcoded English day names (locale-independent) - non-English names rejected with clear error listing valid values
  • expectedDayOfWeek is excluded from TickTick API payloads (validation-only, never sent upstream)
  • Works on both ticktick_create_task (function parameter) and ticktick_update_task (TaskObject field with exclude=True)

Test plan

  • 16 unit tests covering: match/mismatch, case insensitivity, whitespace, timezone boundary crossing, non-English rejection, all 7 days, datetime object input, TaskObject serialization exclusion

When dueDate is set on create_task or update_task, the caller must
also pass expectedDayOfWeek (e.g. 'Monday'). The MCP validates
the date falls on that day - in the task's timeZone when provided -
and returns an error on mismatch. This catches agents that say
'Monday' but pass a Tuesday date.

- Hardcoded English day names (locale-independent)
- Non-English names rejected with clear error listing valid values
- Timezone-aware: resolves day in task timeZone, not just UTC offset
- Field excluded from TickTick API payloads (validation-only)
- 16 tests covering match/mismatch, timezone, i18n, serialization
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.

1 participant