predict_race
Predict race finish times using the Riegel formula based on your known race results to plan training and set realistic goals.
Instructions
Predict race finish times using the Riegel formula based on a known race result
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| known_distance | Yes | Known race distance: "5k", "10k", "half", "marathon", or km value | |
| known_time | Yes | Known race time in H:MM:SS or MM:SS format | |
| target_distance | No | Target distance to predict (defaults to showing all standard distances) |
Implementation Reference
- index.js:257-290 (handler)The `predict_race` tool is defined here using `server.tool`. It takes `known_distance`, `known_time`, and an optional `target_distance` as input parameters. The handler calculates race predictions using the Riegel formula and estimates VO2max.
// Tool: predict_race server.tool( 'predict_race', 'Predict race finish times using the Riegel formula based on a known race result', { known_distance: z.string().describe('Known race distance: "5k", "10k", "half", "marathon", or km value'), known_time: z.string().describe('Known race time in H:MM:SS or MM:SS format'), target_distance: z.string().optional().describe('Target distance to predict (defaults to showing all standard distances)'), }, async ({ known_distance, known_time, target_distance }) => { const distKm = resolveDistance(known_distance); const timeSecs = timeToSeconds(known_time); const vo2max = estimateVO2max(distKm, timeSecs); const targets = target_distance ? [{ name: target_distance, km: resolveDistance(target_distance) }] : [ { name: '5K', km: 5 }, { name: '10K', km: 10 }, { name: 'Half Marathon', km: 21.0975 }, { name: 'Marathon', km: 42.195 }, ]; let text = `Based on ${known_distance} in ${known_time}:\n\nEstimated VO2max: ${vo2max.toFixed(1)} ml/kg/min\n\nPredictions:\n`; targets.forEach(t => { const predicted = predictTime(distKm, timeSecs, t.km); const pace = predicted / t.km; text += `- ${t.name}: ${secondsToTime(predicted)} (pace: ${secondsToPace(pace)}/km)\n`; }); text += `\nNote: Predictions assume equivalent training for the target distance. Use RunDida's Race Time Predictor for more details: ${BASE_URL}/tools/race-time-predictor/`; return { content: [{ type: 'text', text }] }; } );