Skip to content

Add trainingpeaks.com tools: login, page context, navigation and availability - #149

Merged
rgarcia merged 5 commits into
mainfrom
hypeship/trainingpeaks-availability
Nov 27, 2026
Merged

rgarcia merged 5 commits into
mainfrom
hypeship/trainingpeaks-availability

Conversation

@rgarcia

@rgarcia rgarcia commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a trainingpeaks.com namespace. It follows the page-context and navigation pattern from amctheatres.com, resy.com and united.com, and adds tools for TrainingPeaks Availability, the calendar's days-off entries ("unable to train" or "limited availability").

tool kind what it does
login cdp Signs in on home.trainingpeaks.com/login once, after the page's reCAPTCHA v3 token is issued, and confirms the account through the app's session API. It submits with Enter because the cookie-consent overlay can cover the Login button.
get_page_context page Reports the page type from the host and # route, any open workout/activity/availability item, the signed-in account, the calendar's drawn range and today's date, whether an Availability form is open, a structured cookie_banner (visible, settings open, overlay blocking clicks, already answered), live tools, unsettled reasons and next steps.
navigate_to_page page Carries the app's site map (#home, #calendar, #dashboard, #plan, #settings, an Availability entry). It schedules a hash change, a full load or a reload (reload: true, needed because the app shows cached calendar data after switching routes) after returning, and refuses other hosts and leaving an open Availability form unless discard_form is set.
answer_cookie_banner page Presses the OneTrust banner's own Reject All (default) or Accept Cookies button, then confirms the banner closed and reports the recorded consent groups. The banner's overlay intercepts clicks on the whole page.
get_calendar page Reads what the open calendar shows for up to 62 drawn days: workout cards (sport, title, planned/completed/skipped, duration, distance, TSS) and Availability tiles. It never clicks or scrolls, and lists undrawn dates in not_drawn.
list_availability page Reads availability entries in a range of up to 365 days, using the same request the calendar makes.
add_availability page Sends the Availability form's own save request once, after checking for identical or overlapping entries, then reads the entry back and checks every field, returning saved_with_differences with the stored entry if TrainingPeaks stored anything differently.
delete_availability page Deletes one entry only when both the id and the start date match, then confirms it is gone.

lib/trainingpeaks-session.js holds the session and availability model that the four availability/context page tools inline.

The add_availability and delete_availability request shapes were captured from the site's own form and confirmation dialog with the requests stubbed in the page, so nothing was written while capturing them. tpapi publishes no schema (common OpenAPI/Swagger paths 404), so these shapes are inferred from the app's own traffic. Writing through the API leaves the on-screen calendar stale, so both tools tell the caller to reload it with navigate_to_page({ url: "#calendar", reload: true }).

The login tool can be invoked through a Kernel vault webmcp_invoke binding, so the password goes from the vault into the tool input without passing through the agent.

Testing

  • node --test tests/trainingpeaks.test.mjs runs 16 tests against a fabricated account and a stubbed availability API.
  • node scripts/validate-registry.mjs and the full node --test "tests/*.test.mjs" suite pass (4505 tests).
  • A builder live run on a real account covered: login through a vault binding, page context on the calendar, an open entry and the dashboard, navigation including reload and the form guard, list, every no-write guard path of add/delete, answering the cookie banner with Reject All, creating three availability entries, and reading them back from the reloaded calendar with get_calendar.

All eight tools stay draft. They have no independent QA yet, and live deletion has not been exercised.

@rgarcia
rgarcia merged commit 63feda9 into main Nov 27, 2026
1 of 2 checks passed
@rgarcia
rgarcia deleted the hypeship/trainingpeaks-availability branch November 27, 2026 21:24
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