get_heart_rate_zones
Calculate personalized heart rate training zones using maximum heart rate and lactate threshold data to optimize workout intensity.
Instructions
Get personalized heart rate training zones based on max HR and lactate threshold
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:234-252 (handler)The main handler function for the get_heart_rate_zones tool. It fetches the latest heart rate zones from the Supabase database and formats them into readable ranges.async function getHeartRateZones() { const { data, error } = await supabase.from("heart_rate_zones").select("*").limit(1); if (error) throw error; const zones = data?.[0]; if (!zones) return { error: "No heart rate zone data available" }; return { max_hr: zones.max_hr, lactate_threshold_hr: zones.lactate_threshold_hr, zones: { zone1_warmup: `${zones.zone1_floor}-${zones.zone2_floor - 1} bpm`, zone2_easy: `${zones.zone2_floor}-${zones.zone3_floor - 1} bpm`, zone3_aerobic: `${zones.zone3_floor}-${zones.zone4_floor - 1} bpm`, zone4_threshold: `${zones.zone4_floor}-${zones.zone5_floor - 1} bpm`, zone5_maximum: `${zones.zone5_floor}-${zones.max_hr} bpm`, }, }; }
- src/index.ts:375-379 (schema)Input schema and metadata for the get_heart_rate_zones tool as defined in the ListTools response.name: "get_heart_rate_zones", description: "Get personalized heart rate training zones based on max HR and lactate threshold", inputSchema: { type: "object", properties: {} }, },
- src/index.ts:420-422 (registration)Registration and dispatching logic in the CallToolRequestSchema handler's switch statement.case "get_heart_rate_zones": result = await getHeartRateZones(); break;
- src/index.ts:281-287 (helper)Helper usage of getHeartRateZones within the getHealthSummary function to include HR zones data.const [vo2, activities, sleep, races, zones] = await Promise.all([ getVO2Max(), getActivities(), getSleep(), getRacePredictions(), getHeartRateZones(), ]);