Import workouts from other systems (Garmin, Strava, GPX/TCX/FIT files) to local files
import_workoutsLoad .fit, .gpx, or .tcx workout files exported from Garmin, Strava, Apple, or other trackers into a separate local store, with duplicate checks and per-file refusal reasons.
Instructions
Imports workouts exported from OTHER systems (a Garmin Connect export, a Strava bulk export, GPX files from an Apple Watch app or any other tracker) into a local store of their own, /.suunto-mcp/imported/ (SUUNTO_IMPORT_DIR moves it), apart from the Suunto archive (which stays exactly what Suunto sent). path is an ABSOLUTE path to one .fit, .gpx or .tcx file or to a folder: only the files directly in that folder are read (no subfolders, no links, no hidden files, no .gz or .zip: unpack those first; other file types are ignored and counted). This server cannot read macOS's protected folders (/Downloads, ~/Desktop, ~/Documents): ask the user to copy the files to e.g. /tmp/workouts first. Per workout it stores the file byte for byte as .<fit|gpx|tcx> and .json (version, source, format, SHA-256, size, importedAt and a summary { startTime (UTC), durationS, distanceM, avgHr?, maxHr?, ascentM?, sport?, hasGps }); id is the first 16 hex digits of the SHA-256; the record is written last and is the mark 'imported' (files are 0600, a folder the tool creates 0700, each file written complete under a temporary name and linked into place, which fails if the name exists). source ('garmin', 'strava', 'apple' or 'other', default 'other') is only a label kept in the record. Nothing is ever overwritten or deleted. The same file again is skipped (alreadyImported); a DIFFERENT file whose workout starts within 60 s of a stored one and lasts within 5 % of it (the same activity from two systems) is NOT imported and is listed in possibleDuplicate. A file that is not what its extension says, is truncated, or fails the checks (timestamps valid and not in the future, positions on the globe, GPS jumps faster than 12 m/s dropped (30 for cycling and for files that name no sport; the number dropped is summary.droppedJumps), at least 2 GPS points for a GPX track, files over 50 MB refused without being read) is listed in refused with the reason and nothing is written for it. A record or file already in the folder that is damaged, foreign or of a newer version is never changed: a file that matches it is refused. A call reads at most 200 files (new, already imported and refused all count) and imports at most limit new workouts (1-50, default 50); remaining says how many files were not looked at yet and nextAfter is the name of the last file looked at: CALL AGAIN with after set to it until remaining is 0 (a refused file leaves nothing behind, so without after the same files would be read again). Each of alreadyImported, possibleDuplicate, refused and errors lists its first 50 entries only; alreadyImportedCount, possibleDuplicateCount, refusedCount and errorsCount hold the totals. It reads only the given files and writes only in the imports folder: it never contacts Suunto or any network and needs no Suunto credentials. Output: { dir, source, found, examined, newlyImported, imported: [{ file, id, format, source, summary }], alreadyImported: [{ file, id }], alreadyImportedCount, possibleDuplicate: [{ file, sameAs, startTime }], possibleDuplicateCount, refused: [{ file, reason }], refusedCount, errors: [{ file, error }] (a file that could not be saved), errorsCount, ignored: { otherTypes, subfolders, links, hidden, gzipped }, remaining, nextAfter, notes }. estimate_route_time also uses an imported workout, but ONLY if its sport is walking, hiking or running (and it carries altitude, distance and time): the sport is read from a FIT file's session, a GPX file's first track , or a TCX file's Sport attribute, and TCX knows only Running, Biking and Other, so TCX walks and hikes do not count; a GPX file without a does not count (Apple Watch route GPX files are likely untyped; unverified), and notes says how many imported workouts name no sport. Only the first session of a FIT file is read (multi-sport files are summarised by their first session). Sleep, HRV and recovery data are deliberately NOT imported, and Apple Health's export.xml is not supported (GPX routes from it work). The parsers have been verified on synthetic files only. In demo mode the store is in memory and nothing is written to disk (the files are still read from path).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>"
},
"name": "import_workouts"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to one .fit, .gpx or .tcx file or to a folder holding them (not recursive). | |
| after | No | Only files whose name sorts after this one are looked at: pass the previous call's nextAfter to continue a folder of more than 200 files. | |
| limit | No | Most new workouts to import in this call (default and maximum 50). | |
| source | No | Label for where the files come from, kept in each record (default 'other'). | other |