export_workout_gpx
Export a workout's GPS route as GPX 1.1 XML with lat, lon, elevation, and timestamps. Directly import to Strava, Komoot, or Google Earth.
Instructions
Returns the workout's GPS route as a GPX 1.1 XML string (not JSON). Each trackpoint contains lat, lon, elevation, and timestamp. Suitable for direct import into Strava, Komoot, Google Earth, or any GPX-compatible tool. Returns a valid but empty GPX document if the workout has no GPS data. Use get_workout_samples for numeric time-series (HR, power, cadence) instead of GPS. Read-only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workoutKey | Yes | Opaque server-assigned string returned by list_workouts. Not guessable or constructable — always discover via list_workouts first. Passing an invalid key throws SuuntoNotFoundError. |
Implementation Reference
- src/index.ts:339-342 (handler)MCP tool handler for export_workout_gpx: calls suunto.getWorkoutGpx and returns the GPX XML string.
case "export_workout_gpx": { const bytes = await suunto.getWorkoutGpx(a.workoutKey); return text(new TextDecoder().decode(bytes)); } - src/index.ts:135-150 (schema)Schema/tool definition for export_workout_gpx: name, description, and inputSchema requiring workoutKey.
{ name: "export_workout_gpx", description: "Returns the workout's GPS route as a GPX 1.1 XML string (not JSON). Each trackpoint contains lat, lon, elevation, and timestamp. Suitable for direct import into Strava, Komoot, Google Earth, or any GPX-compatible tool. Returns a valid but empty GPX document if the workout has no GPS data. Use get_workout_samples for numeric time-series (HR, power, cadence) instead of GPS. Read-only.", inputSchema: { type: "object", properties: { workoutKey: { type: "string", minLength: 1, description: "Opaque server-assigned string returned by list_workouts. Not guessable or constructable — always discover via list_workouts first. Passing an invalid key throws SuuntoNotFoundError.", }, }, required: ["workoutKey"], }, }, - src/index.ts:306-306 (registration)Registration: the tool definition is part of the 'tools' array registered via ListToolsRequestSchema handler.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools })); - src/api.ts:126-128 (helper)API client method that calls the Suunto cloud API endpoint /v2/workout/exportGpx to fetch the GPX data as a Buffer.
getWorkoutGpx(workoutKey: string) { return this.bytes(`/v2/workout/exportGpx/${encodeURIComponent(workoutKey)}`); } - src/cli.ts:98-103 (helper)CLI handler for export-workout-gpx command: parses workoutKey from args and outputs GPX to stdout.
case "export-workout-gpx": { const key = rest[0] ?? die("Usage: export-workout-gpx <workoutKey>"); const bytes = await suunto.getWorkoutGpx(key); process.stdout.write(new TextDecoder().decode(bytes) + "\n"); break; }