fix: add "custom" to MCP time summary period enum#1672
Open
pib wants to merge 2 commits intocallumalpass:mainfrom
Open
fix: add "custom" to MCP time summary period enum#1672pib wants to merge 2 commits intocallumalpass:mainfrom
pib wants to merge 2 commits intocallumalpass:mainfrom
Conversation
The tasknotes_get_time_summary MCP tool declares `from` and `to` parameters for custom date ranges, but Zod enum validation rejects any period value not in [today, week, month, all]. The underlying computeDateRange() already handles custom ranges in its default case — this just lets the value through. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verifies that period="custom" with fromDate/toDate correctly filters time entries to only those within the specified range. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The
tasknotes_get_time_summaryMCP tool declaresfromandtoparameters for custom date ranges, but they never work because the Zod enum forperiodonly allowstoday|week|month|all. The HTTP API (/api/time/summary) works fine withperiod=custom&from=...&to=...because it has no enum validation.Root cause
src/services/MCPService.tsline 529 — Zod enum validation prevents any period value other thantoday/week/month/allfrom reaching thedefaultcase incomputeDateRange(), which is wherefromDate/toDateare used.Fix
Add
"custom"to the Zod enum. Thedefaultcase incomputeDateRangealready handles the rest correctly.Test plan
period=custom,from,toreturns data scoped to custom rangecomputeTimeSummarywith custom period and date range filteringtoday,week,month,all) unaffectedfrom/tofalls back to today (no error)