Skip to main content
Glama
SkyBlob12

Strava MCP Server

by SkyBlob12

Distribution des zones d'allure

strava_pace_zones

Analyze your weekly running distance by pace zones (Recovery to Anaerobic) and verify adherence to the 80/20 rule. Optionally input your lactate threshold pace for accurate zone calculation.

Instructions

Analyse la répartition des kilomètres par zone d'allure (Récupération, Facile, Aérobie, Seuil, VO2max, Anaérobie). Aide à vérifier la règle 80/20 (80% en zones basses).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
weeksNoNombre de semaines à analyser
threshold_pace_min_kmNoAllure au seuil lactique au format 'M:SS' par km (ex: '4:30'). Si absent, estimée depuis les activités récentes.

Implementation Reference

  • Registration of the 'strava_pace_zones' tool via server.registerTool() inside registerAnalysisTools().
    server.registerTool(
      "strava_pace_zones",
      {
        title: "Distribution des zones d'allure",
        description:
          "Analyse la répartition des kilomètres par zone d'allure (Récupération, Facile, Aérobie, " +
          "Seuil, VO2max, Anaérobie). Aide à vérifier la règle 80/20 (80% en zones basses).",
        inputSchema: z.object({
          weeks: z.number().int().min(1).max(26).default(8).describe("Nombre de semaines à analyser"),
          threshold_pace_min_km: z
            .string()
            .optional()
            .describe(
              "Allure au seuil lactique au format 'M:SS' par km (ex: '4:30'). " +
                "Si absent, estimée depuis les activités récentes."
            ),
        }),
      },
      async ({ weeks, threshold_pace_min_km }) => {
        const afterEpoch = Math.floor(Date.now() / 1000) - weeks * 7 * 86400;
        const activities = await listAllActivities(afterEpoch);
        const runs = activities.filter((a) => a.type === "Run" && !a.trainer && a.distance > 500);
    
        // Determine threshold speed
        let thresholdSpeedMps: number;
        if (threshold_pace_min_km) {
          const [min, sec] = threshold_pace_min_km.split(":").map(Number);
          const secPerKm = min * 60 + (sec ?? 0);
          thresholdSpeedMps = 1000 / secPerKm;
        } else {
          // Estimate: top 10% of average speeds as proxy for threshold
          const speeds = runs.map((r) => r.average_speed).sort((a, b) => b - a);
          const top10 = speeds.slice(0, Math.max(1, Math.floor(speeds.length * 0.1)));
          const avgTopSpeed = top10.reduce((s, v) => s + v, 0) / top10.length;
          thresholdSpeedMps = avgTopSpeed * 0.9; // Threshold ~90% of best effort
        }
    
        const distribution = computePaceZoneDistribution(runs, thresholdSpeedMps);
        const thresholdPaceStr = formatPaceFromSecPerKm(speedToSecPerKm(thresholdSpeedMps));
    
        const easyAndBelow = distribution
          .filter((z) => ["Recovery", "Easy", "Aerobic"].includes(z.zone))
          .reduce((s, z) => s + z.percentage, 0);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  periode: `${weeks} dernières semaines`,
                  allure_seuil_estimee: `${thresholdPaceStr} /km`,
                  zones: distribution,
                  regle_80_20: {
                    zones_basses_pct: easyAndBelow,
                    zones_hautes_pct: 100 - easyAndBelow,
                    objectif: "80% zones basses, 20% zones hautes",
                    statut: easyAndBelow >= 75 ? "✓ Bonne polarisation" : "⚠ Trop de zones hautes",
                  },
                },
                null,
                2
              ),
            },
          ],
        };
      }
    );
  • The async handler function for strava_pace_zones: fetches activities, determines threshold pace, calls computePaceZoneDistribution, and returns zones + 80/20 rule analysis.
      async ({ weeks, threshold_pace_min_km }) => {
        const afterEpoch = Math.floor(Date.now() / 1000) - weeks * 7 * 86400;
        const activities = await listAllActivities(afterEpoch);
        const runs = activities.filter((a) => a.type === "Run" && !a.trainer && a.distance > 500);
    
        // Determine threshold speed
        let thresholdSpeedMps: number;
        if (threshold_pace_min_km) {
          const [min, sec] = threshold_pace_min_km.split(":").map(Number);
          const secPerKm = min * 60 + (sec ?? 0);
          thresholdSpeedMps = 1000 / secPerKm;
        } else {
          // Estimate: top 10% of average speeds as proxy for threshold
          const speeds = runs.map((r) => r.average_speed).sort((a, b) => b - a);
          const top10 = speeds.slice(0, Math.max(1, Math.floor(speeds.length * 0.1)));
          const avgTopSpeed = top10.reduce((s, v) => s + v, 0) / top10.length;
          thresholdSpeedMps = avgTopSpeed * 0.9; // Threshold ~90% of best effort
        }
    
        const distribution = computePaceZoneDistribution(runs, thresholdSpeedMps);
        const thresholdPaceStr = formatPaceFromSecPerKm(speedToSecPerKm(thresholdSpeedMps));
    
        const easyAndBelow = distribution
          .filter((z) => ["Recovery", "Easy", "Aerobic"].includes(z.zone))
          .reduce((s, z) => s + z.percentage, 0);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  periode: `${weeks} dernières semaines`,
                  allure_seuil_estimee: `${thresholdPaceStr} /km`,
                  zones: distribution,
                  regle_80_20: {
                    zones_basses_pct: easyAndBelow,
                    zones_hautes_pct: 100 - easyAndBelow,
                    objectif: "80% zones basses, 20% zones hautes",
                    statut: easyAndBelow >= 75 ? "✓ Bonne polarisation" : "⚠ Trop de zones hautes",
                  },
                },
                null,
                2
              ),
            },
          ],
        };
      }
    );
  • Input schema for strava_pace_zones: weeks (1-26, default 8) and optional threshold_pace_min_km string.
    inputSchema: z.object({
      weeks: z.number().int().min(1).max(26).default(8).describe("Nombre de semaines à analyser"),
      threshold_pace_min_km: z
        .string()
        .optional()
        .describe(
          "Allure au seuil lactique au format 'M:SS' par km (ex: '4:30'). " +
            "Si absent, estimée depuis les activités récentes."
        ),
    }),
  • computePaceZoneDistribution: core helper that classifies runs into pace zones relative to threshold speed and returns distance/percentage per zone.
    export function computePaceZoneDistribution(
      activities: StravaActivity[],
      thresholdSpeedMps: number
    ): PaceZoneDistribution[] {
      const runs = activities.filter((a) => a.type === "Run" && !a.trainer && a.distance > 0);
      const zoneDistances = new Map<PaceZone, number>();
    
      for (const run of runs) {
        const zone = classifyPaceZone(run.average_speed, thresholdSpeedMps);
        zoneDistances.set(zone, (zoneDistances.get(zone) ?? 0) + run.distance);
      }
    
      const totalM = Array.from(zoneDistances.values()).reduce((s, v) => s + v, 0);
      const zones: PaceZone[] = ["Recovery", "Easy", "Aerobic", "Threshold", "VO2Max", "Anaerobic"];
    
      return zones.map((zone) => {
        const distanceM = zoneDistances.get(zone) ?? 0;
        return {
          zone,
          distanceKm: metersToKm(distanceM),
          percentage: totalM > 0 ? Math.round((distanceM / totalM) * 100) : 0,
        };
      });
    }
  • classifyPaceZone: classifies a single speed into a PaceZone (Recovery/Easy/Aerobic/Threshold/VO2Max/Anaerobic) based on ratio to threshold speed.
    export function classifyPaceZone(
      speedMps: number,
      thresholdSpeedMps: number
    ): PaceZone {
      const ratio = speedMps / thresholdSpeedMps;
      if (ratio < 0.74) return "Recovery";
      if (ratio < 0.84) return "Easy";
      if (ratio < 0.91) return "Aerobic";
      if (ratio < 0.97) return "Threshold";
      if (ratio < 1.05) return "VO2Max";
      return "Anaerobic";
    }
Behavior2/5

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

With no annotations, the description carries full burden for behavioral traits. It states what the tool analyzes but omits details like data source (Strava activities), required authentication, return format, or any side effects. This is insufficient for an AI agent to understand the tool's behavior.

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 two concise sentences with no unnecessary words. The first sentence front-loads the verb and resource, making it immediately understandable.

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 the tool's simplicity (2 optional parameters, no output schema), the description is adequate for a basic analysis tool. However, it lacks information on prerequisites (e.g., authentication) and output format, which would improve completeness.

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 does not add any information about the parameters (e.g., how threshold_pace_min_km is used or the implications of default weeks). It relies entirely on the schema.

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?

The description clearly states the verb 'analyse' and the resource 'répartition des kilomètres par zone d'allure', listing the specific zones. It also mentions the 80/20 rule, providing additional context. This distinguishes it from sibling tools like strava_training_load or strava_weekly_workout.

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?

The description explicitly ties usage to verifying the 80/20 rule, giving a clear use case. However, it does not mention when not to use this tool or compare it to alternatives, leaving some ambiguity.

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/SkyBlob12/McpStrava'

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