Skip to main content
Glama

predict_race

Predict finish times for standard race distances by applying the Riegel formula to a known race result.

Instructions

Predict race finish times using the Riegel formula based on a known race result

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
known_distanceYesKnown race distance: "5k", "10k", "half", "marathon", or km value
known_timeYesKnown race time in H:MM:SS or MM:SS format
target_distanceNoTarget distance to predict (defaults to showing all standard distances)

Implementation Reference

  • The main handler function for the predict_race tool. It receives known_distance, known_time, and optional target_distance, resolves them using helper functions, computes predictions using the Riegel formula and VO2max estimation, and returns formatted race predictions.
      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 }] };
      }
    );
  • Input schema for predict_race using Zod: known_distance (string, required), known_time (string, required), target_distance (string, optional).
    '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)'),
    },
  • index.js:269-301 (registration)
    Registration of the 'predict_race' tool via server.tool() with name, description, schema, and handler function.
    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 }] };
      }
    );
  • The predictTime function implements the Riegel formula (exponential scaling) used to predict race finish times.
    function predictTime(knownDist, knownTimeSecs, targetDist, exponent = 1.06) {
      return knownTimeSecs * Math.pow(targetDist / knownDist, exponent);
    }
  • The estimateVO2max function (Jack Daniels method) used to estimate VO2max from a known race result.
    function estimateVO2max(distKm, timeSecs) {
      const timeMin = timeSecs / 60;
      const velocity = distKm * 1000 / timeMin; // meters per minute
      const pctVO2max = 0.8 + 0.1894393 * Math.exp(-0.012778 * timeMin)
        + 0.2989558 * Math.exp(-0.1932605 * timeMin);
      const vo2 = -4.60 + 0.182258 * velocity + 0.000104 * velocity * velocity;
      return vo2 / pctVO2max;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It mentions the Riegel formula but does not disclose behavioral details such as handling of invalid inputs, precision of results, or edge cases. The default behavior for target_distance is described in the schema, not the description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that front-loads the main purpose. Every word is informative and there is no unnecessary content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given three parameters, no output schema, and no annotations, the description is adequate but lacks details on output format, edge cases, or relation to sibling tools like 'calculate_pace'. It is minimally complete but leaves gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds no extra meaning beyond the schema. Known distance and time formats are already documented in the schema, and the target_distance description in the schema explains default behavior.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool predicts race finish times using the Riegel formula based on a known race result. It is a specific verb-resource combination, but does not explicitly distinguish from the sibling 'calculate_pace' tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when a known race result is available and one wants to predict finish times for other distances. However, it does not provide explicit when-to-use or when-not-to-use guidance, nor does it mention alternatives like 'calculate_pace'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/XWeaponX7/rundida-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server