Repository navigation
[intervals-mcp-server] Fix calendar tools and add planning projection to the coach report - #2
Merged
Merged
Conversation
get_event_by_id called /athlete/{id}/event/{eventId}, which returns 404; the
Intervals.icu endpoint is /events/{eventId} like update and delete. Event
details now show category, sport, planned load and planned time, and detect
races from the RACE_A/B/C category.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The event list of the API has no workout object, so every event was shown as "Type: Other". Summaries now use category, type, icu_training_load and moving_time (N/A when missing), and detect races from RACE_A/B/C. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Updates sent description/moving_time/distance as null, always set category WORKOUT and moved the event to today when no date was given, so renaming an event cleared its description or turned a NOTE into a WORKOUT. None values are now dropped, category/type/date/color are only sent on update when passed, and workout_type is optional so an event can be renamed. add_or_update_event takes an optional category (e.g. RACE_A). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A future end_date treated planned days as rest days (ACWR/deload/HRV false alarms) and labelled CTL values that already included planned workouts as recomputed_without_planned. In projection mode, sections from completed training end at the last completed day, recovery refers to today, CTL/ATL/TSB at the end date are reported as api_incl_planned with load.actual and load.projected, and a plan section summarises planned workouts per week and sport (planned load, rest days, missing loads, projected CTL/ramp/TSB, races). New flags ramp_planned_high, tsb_planned_low and planned_rest_days_low; flags carry basis actual/projection. Reports without a future end date are unchanged apart from schema_version and period.mode (snapshot test). Co-Authored-By: Claude Opus 5.5 (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
get_event_by_id: called/athlete/{id}/event/{eventId}(always 404); now uses/events/{eventId}like update/delete.get_events/get_event_by_id: show category, sport, planned load and planned time instead ofType: Other(N/Awhen Intervals.icu has no value); races are detected fromRACE_A/B/C.nulldescription, no forcedcategory: WORKOUT, no move to today when no date is given.workout_typeis optional (renaming works), new optionalcategory(e.g.RACE_A).get_coach_reportschema 1.1: projection mode for a futureend_date:period.mode,load.actual/load.projected,recovery.as_ofplansection: planned load, hours and sessions per ISO week and sport family, rest days,missing_load, projected CTL/ramp/tsb_min, races 12 weeks aheadramp_planned_high(> 6),tsb_planned_low(< −20 / < −30),planned_rest_days_low; every flag carriesbasis: actual|projectionload.src = api_incl_plannedfor values that include planned workouts;recomputed_without_plannedonly for days up to todayCompatibility
end_dateare unchanged apart fromschema_version: "1.1"andperiod.mode: "actual"(snapshot test against the 1.0 output).add_or_update_event:nameis now the first parameter andworkout_typeis optional. MCP clients pass named arguments; there are no positional callers in the repo.get_coach_reportfetches the athlete first also with an explicitend_date(one extra round trip), because the athlete's "today" decides the mode.Intervals.icu API assumptions (verified with read-only live calls)
category,type,icu_training_load(nullfor workouts without targets),moving_time(s),start_date_local.GET /athlete/{id}/events/{eventId}returns the event.category=RACE_A,RACE_B,RACE_Cfilters/eventsserver-side.ctl,atl,rampRateincluding planned workouts;rampRate= CTL(d) − CTL(d−7).Testing
pytest: 202 passed.ruff,mypy: no new findings (the two F401 inserver.pyandpower_curves.pyalready exist on main).pylintas in CI: no new findings; the existing ones inpower_curves.py,gear.py,server.pyandformatting.pyare unchanged.get_eventsandget_event_by_idshow sport, category, planned load and time.get_coach_report(days=14, end_date="2026-10-04"):mode: projection, plan W40 load 817 withmissing_load: 2, projected CTL 105.1 / ramp 2.4 (api_incl_planned),load.actualCTL does not rise with planned-but-not-done load,tsb_planned_lowwarning at −23.0.get_coach_report():mode: actual, keys unchanged.Known limitations
planstarts tomorrow; a second session planned for today is then missing fromplan(it is still in the CTL projection).missing_load.rampis checked at the end of each week only;planned_rest_days_lowonly for fully planned weeks.🤖 Generated with Claude Code