Skip to content

feat: support custom bpm heart-rate range in create_run_workout - #202

Closed
mmccomiskey wants to merge 1 commit into
Taxuspt:mainfrom
mmccomiskey:feat/custom-hr-bpm-range-run-workout
Closed

feat: support custom bpm heart-rate range in create_run_workout#202
mmccomiskey wants to merge 1 commit into
Taxuspt:mainfrom
mmccomiskey:feat/custom-hr-bpm-range-run-workout

Conversation

@mmccomiskey

Copy link
Copy Markdown
Contributor

Summary

  • create_run_workout only accepted a named Garmin HR zone (Z1-Z5), but not every real training target lines up with a whole zone — e.g. a 136-148 bpm Zone 2 goal straddles Z2 (118-137) and Z3 (138-157). The watch would show "in range" for the entire zone (up to 157 bpm) even when the intended ceiling was lower, silently misleading in-workout HR feedback.
  • Adds optional hr_min/hr_max params. When both are given, the workout targets an exact custom bpm range (targetValueOne/targetValueTwo) instead of a zoneNumber — a target shape Garmin Connect already supports natively (same heart.rate.zone target type), just not previously exposed by this tool.
  • hr_zone remains the default, unchanged behavior when no range is given.

Test plan

  • Existing unit/integration tests for create_run_workout / build_run_json pass unchanged (zone-based path untouched)
  • New unit tests: custom range builds targetValueOne/targetValueTwo with no zoneNumber; rejects a lone hr_min/hr_max; rejects hr_min >= hr_max
  • New integration test: tool call with hr_min/hr_max produces the expected uploaded JSON
  • Verified end-to-end against the live Garmin Connect API (not just mocks): uploaded a throwaway workout with a 136-148 bpm range, fetched it back, confirmed targetValueOne=136.0, targetValueTwo=148.0, zoneNumber=None, then deleted the test workout

🤖 Generated with Claude Code

Named Garmin zones (Z1-Z5) don't always match a real training target -
e.g. a 136-148 bpm Zone 2 goal straddles Garmin's Z2 (118-137) and Z3
(138-157). Previously create_run_workout only accepted hr_zone, so the
watch would show "in range" for the whole zone (up to 157 bpm) even
when the actual target ceiling was lower, silently misleading the
in-workout HR feedback.

Add optional hr_min/hr_max params that build a custom bpm-range target
(targetValueOne/targetValueTwo) instead of a zoneNumber, matching a
range Garmin Connect already supports natively but this tool didn't
expose. hr_zone remains the default and is ignored when a range is
given. Verified against the live Garmin Connect API: the custom range
round-trips correctly with no zoneNumber set.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Taxuspt

Taxuspt commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Closed: the changes from this PR were applied locally, tested with CI, and merged via PR #224. Thank you for the contribution @mmccomiskey!

@Taxuspt Taxuspt closed this Jul 28, 2026
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