get_vo2max
Retrieve VO2 max history and trends to measure cardiovascular fitness levels over time. Analyze fitness data by date range and sport type for performance tracking.
Instructions
Get VO2 max history and trends. VO2 max measures cardiovascular fitness in ml/kg/min.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start_date | No | Start date (YYYY-MM-DD) | |
| end_date | No | End date (YYYY-MM-DD, exclusive recommended) | |
| sport | No | Filter by sport (e.g., 'running', 'cycling') |
Implementation Reference
- src/index.ts:68-97 (handler)The handler function for the 'get_vo2max' tool. It queries the 'vo2_max' table in Supabase for VO2 max values filtered by optional start_date, end_date, and sport parameters. Computes and returns a summary (count, first, latest, min, max, average) along with the raw data.async function getVO2Max(startDate?: string, endDate?: string, sport?: string) { let query = supabase .from("vo2_max") .select("calendar_date, vo2_max_value, sport") .order("calendar_date", { ascending: true }); if (startDate) query = query.gte("calendar_date", startDate); // End date is exclusive if (endDate) query = query.lt("calendar_date", endDate); if (sport) query = query.eq("sport", sport); const { data, error } = await query; if (error) throw error; const values = (data || []).map((v) => v.vo2_max_value); const summary = { count: data?.length || 0, first: data?.[0] ?? null, latest: data?.[data.length - 1] ?? null, min: values.length ? Math.min(...values) : null, max: values.length ? Math.max(...values) : null, average: values.length ? Math.round( (values.reduce((a, b) => a + b, 0) / values.length) * 10 ) / 10 : null, }; return { summary, data }; }
- src/index.ts:331-338 (schema)The input schema definition for the 'get_vo2max' tool, specifying optional parameters: start_date, end_date, and sport as strings.inputSchema: { type: "object", properties: { start_date: { type: "string", description: "Start date (YYYY-MM-DD)" }, end_date: { type: "string", description: "End date (YYYY-MM-DD, exclusive recommended)" }, sport: { type: "string", description: "Filter by sport (e.g., 'running', 'cycling')" }, }, },
- src/index.ts:327-339 (registration)Registration of the 'get_vo2max' tool in the ListTools response, including name, description, and input schema.{ name: "get_vo2max", description: "Get VO2 max history and trends. VO2 max measures cardiovascular fitness in ml/kg/min.", inputSchema: { type: "object", properties: { start_date: { type: "string", description: "Start date (YYYY-MM-DD)" }, end_date: { type: "string", description: "End date (YYYY-MM-DD, exclusive recommended)" }, sport: { type: "string", description: "Filter by sport (e.g., 'running', 'cycling')" }, }, }, },
- src/index.ts:408-410 (registration)Dispatch/execution registration in the CallToolRequest handler switch statement, mapping the tool name to the getVO2Max handler function.case "get_vo2max": result = await getVO2Max(a.start_date, a.end_date, a.sport); break;