Skip to main content
Glama

calculate_pace

Compute running pace, finish time, or distance from any two inputs: distance, time, or pace.

Instructions

Calculate running pace, finish time, or distance. Provide any two of: distance, time, pace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
distanceNoDistance: "5k", "10k", "half", "marathon", or km value like "15"
timeNoFinish time in H:MM:SS or MM:SS format, e.g. "3:30:00" or "25:00"
paceNoPace per km in M:SS format, e.g. "5:00"

Implementation Reference

  • index.js:212-266 (registration)
    Registration of the 'calculate_pace' tool via server.tool() with name, description, schema, and handler.
    // Tool: calculate_pace
    server.tool(
      'calculate_pace',
      'Calculate running pace, finish time, or distance. Provide any two of: distance, time, pace.',
      {
        distance: z.string().optional().describe('Distance: "5k", "10k", "half", "marathon", or km value like "15"'),
        time: z.string().optional().describe('Finish time in H:MM:SS or MM:SS format, e.g. "3:30:00" or "25:00"'),
        pace: z.string().optional().describe('Pace per km in M:SS format, e.g. "5:00"'),
      },
      async ({ distance, time, pace }) => {
        const given = [distance, time, pace].filter(Boolean).length;
        if (given < 2) throw new Error('Provide at least 2 of: distance, time, pace');
    
        let result = {};
    
        if (distance && time) {
          const distKm = resolveDistance(distance);
          const timeSecs = timeToSeconds(time);
          const paceSecs = timeSecs / distKm;
          result = {
            distance: `${distKm} km`,
            time: secondsToTime(timeSecs),
            pace: `${secondsToPace(paceSecs)}/km`,
            speed: `${(distKm / (timeSecs / 3600)).toFixed(2)} km/h`,
          };
        } else if (distance && pace) {
          const distKm = resolveDistance(distance);
          const paceSecs = paceToSeconds(pace);
          const timeSecs = distKm * paceSecs;
          result = {
            distance: `${distKm} km`,
            time: secondsToTime(timeSecs),
            pace: `${secondsToPace(paceSecs)}/km`,
            speed: `${(distKm / (timeSecs / 3600)).toFixed(2)} km/h`,
          };
        } else if (time && pace) {
          const timeSecs = timeToSeconds(time);
          const paceSecs = paceToSeconds(pace);
          const distKm = timeSecs / paceSecs;
          result = {
            distance: `${distKm.toFixed(2)} km`,
            time: secondsToTime(timeSecs),
            pace: `${secondsToPace(paceSecs)}/km`,
            speed: `${(distKm / (timeSecs / 3600)).toFixed(2)} km/h`,
          };
        }
    
        return {
          content: [{
            type: 'text',
            text: Object.entries(result).map(([k, v]) => `${k}: ${v}`).join('\n'),
          }],
        };
      }
    );
  • Input schema defining three optional string parameters: distance, time, and pace.
      distance: z.string().optional().describe('Distance: "5k", "10k", "half", "marathon", or km value like "15"'),
      time: z.string().optional().describe('Finish time in H:MM:SS or MM:SS format, e.g. "3:30:00" or "25:00"'),
      pace: z.string().optional().describe('Pace per km in M:SS format, e.g. "5:00"'),
    },
  • Handler function that calculates running pace, finish time, or distance from any two inputs (distance+time, distance+pace, or time+pace). Returns formatted results.
    async ({ distance, time, pace }) => {
      const given = [distance, time, pace].filter(Boolean).length;
      if (given < 2) throw new Error('Provide at least 2 of: distance, time, pace');
    
      let result = {};
    
      if (distance && time) {
        const distKm = resolveDistance(distance);
        const timeSecs = timeToSeconds(time);
        const paceSecs = timeSecs / distKm;
        result = {
          distance: `${distKm} km`,
          time: secondsToTime(timeSecs),
          pace: `${secondsToPace(paceSecs)}/km`,
          speed: `${(distKm / (timeSecs / 3600)).toFixed(2)} km/h`,
        };
      } else if (distance && pace) {
        const distKm = resolveDistance(distance);
        const paceSecs = paceToSeconds(pace);
        const timeSecs = distKm * paceSecs;
        result = {
          distance: `${distKm} km`,
          time: secondsToTime(timeSecs),
          pace: `${secondsToPace(paceSecs)}/km`,
          speed: `${(distKm / (timeSecs / 3600)).toFixed(2)} km/h`,
        };
      } else if (time && pace) {
        const timeSecs = timeToSeconds(time);
        const paceSecs = paceToSeconds(pace);
        const distKm = timeSecs / paceSecs;
        result = {
          distance: `${distKm.toFixed(2)} km`,
          time: secondsToTime(timeSecs),
          pace: `${secondsToPace(paceSecs)}/km`,
          speed: `${(distKm / (timeSecs / 3600)).toFixed(2)} km/h`,
        };
      }
    
      return {
        content: [{
          type: 'text',
          text: Object.entries(result).map(([k, v]) => `${k}: ${v}`).join('\n'),
        }],
      };
    }
  • Helper function paceToSeconds: converts 'M:SS' pace string to total seconds.
    function paceToSeconds(pace) {
      const [m, s] = pace.split(':').map(Number);
      return m * 60 + (s || 0);
    }
  • Helper function secondsToPace: converts seconds to 'M:SS' pace format.
    function secondsToPace(secs) {
      const m = Math.floor(secs / 60);
      const s = Math.round(secs % 60);
      return `${m}:${s.toString().padStart(2, '0')}`;
    }
Behavior3/5

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

No annotations are present, so description must carry the burden. It describes the core behavior (calculating one from two) but does not disclose error handling, return format, or limitations beyond the input schema.

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?

Two sentences with no wasted words. Front-loaded with purpose and immediately followed by usage rule. Exemplary conciseness.

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

Completeness4/5

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

Given no output schema, the description does not specify what is returned, but for a calculator it's natural to return the computed value. Sibling tools are clearly different. Could mention output format but still sufficient.

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

Parameters4/5

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

Schema coverage is 100% with format descriptions. The description adds the key semantics that exactly two parameters must be provided and which one is inferred. This adds value beyond the individual parameter descriptions.

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

Purpose5/5

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

Description clearly states it calculates pace, finish time, or distance from any two inputs. Verb 'calculate' and resource 'running pace, finish time, or distance' are specific and distinguishable from sibling tools like get_guide or heart_rate_zones.

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

Usage Guidelines4/5

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

Explicitly instructs to provide any two of the three parameters, which is clear usage guidance. However, no when-not-to-use or alternative tool references are provided, but given the tool's simplicity this is adequate.

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