@trainheroic-unofficial/coach-mcp 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.mjs +160 -75
- package/package.json +3 -3
package/dist/server.mjs
CHANGED
|
@@ -163,32 +163,45 @@ const loggedSetSchema = z.object({
|
|
|
163
163
|
param2: z.union([z.number(), z.string()]).optional()
|
|
164
164
|
});
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
166
|
+
* A logged set that can name the prescribed position it fills. `slot` is the 1-based set
|
|
167
|
+
* index in the prescription (10 max) the result should land in; omit it to fill the next
|
|
168
|
+
* sequential position (the first entry is set 1, the second set 2, and so on). Targeting a
|
|
169
|
+
* slot lets a partial log land in the right positions of a multi-set prescription — e.g.
|
|
170
|
+
* three top singles into the 4th/5th/6th positions of an `8,5,3,1,1,1` ramp. Used by the
|
|
171
|
+
* by-set logging write (not the by-exercise session log, where each exercise's sets are
|
|
172
|
+
* always sequential).
|
|
169
173
|
*/
|
|
170
|
-
const
|
|
174
|
+
const loggedSetWithSlotSchema = loggedSetSchema.extend({ slot: z.number().int().min(1).max(10).optional() });
|
|
175
|
+
/**
|
|
176
|
+
* Args for the coach "log for athlete" write — the same shape as logSetArgsSchema plus the
|
|
177
|
+
* roster `athleteId` whose set is being logged on their behalf.
|
|
178
|
+
*/
|
|
179
|
+
const coachLogSetArgsSchema = z.object({
|
|
171
180
|
date: dateString,
|
|
172
181
|
savedWorkoutSetId: idArgSchema,
|
|
173
182
|
results: z.array(z.object({
|
|
174
183
|
savedWorkoutSetExerciseId: idArgSchema,
|
|
175
|
-
sets: z.array(
|
|
184
|
+
sets: z.array(loggedSetWithSlotSchema).min(1)
|
|
176
185
|
})).min(1)
|
|
177
|
-
});
|
|
178
|
-
/**
|
|
179
|
-
* Args for the coach "log for athlete" write — the same shape as logSetArgsSchema plus the
|
|
180
|
-
* roster `athleteId` whose set is being logged on their behalf.
|
|
181
|
-
*/
|
|
182
|
-
const coachLogSetArgsSchema = logSetArgsSchema.extend({ athleteId: idArgSchema });
|
|
186
|
+
}).extend({ athleteId: idArgSchema });
|
|
183
187
|
/**
|
|
184
|
-
* Args for the coach prescription-override write.
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
188
|
+
* Args for the coach prescription-override write. Like {@link coachLogSetArgsSchema}
|
|
189
|
+
* (athleteId + date + savedWorkoutSetId + per-exercise `sets`), but the values are prescribed
|
|
190
|
+
* targets (param1 = reps, param2 = weight) written to the athlete's plan without marking the set
|
|
191
|
+
* performed. The write replaces this athlete's whole prescription for the set, so its sets are
|
|
192
|
+
* positional and sequential by definition: it deliberately omits the log path's `slot` field (a
|
|
193
|
+
* sparse, slot-targeted prescription has no meaning here) by building its results off
|
|
194
|
+
* {@link loggedSetSchema} rather than {@link loggedSetWithSlotSchema}.
|
|
190
195
|
*/
|
|
191
|
-
const coachPrescribeSetArgsSchema =
|
|
196
|
+
const coachPrescribeSetArgsSchema = z.object({
|
|
197
|
+
date: dateString,
|
|
198
|
+
savedWorkoutSetId: idArgSchema,
|
|
199
|
+
athleteId: idArgSchema,
|
|
200
|
+
results: z.array(z.object({
|
|
201
|
+
savedWorkoutSetExerciseId: idArgSchema,
|
|
202
|
+
sets: z.array(loggedSetSchema).min(1)
|
|
203
|
+
})).min(1)
|
|
204
|
+
});
|
|
192
205
|
/**
|
|
193
206
|
* Args for the coach per-athlete exercise swap: replace the exercise prescribed in one of a
|
|
194
207
|
* roster athlete's saved-workout slots with a different exercise, the API equivalent of the
|
|
@@ -776,6 +789,10 @@ function asExerciseList(body) {
|
|
|
776
789
|
function isRecord(x) {
|
|
777
790
|
return typeof x === "object" && x !== null && !Array.isArray(x);
|
|
778
791
|
}
|
|
792
|
+
/** A non-empty string, or null. Narrows a loosely-typed API field to a usable string. */
|
|
793
|
+
function str$1(v) {
|
|
794
|
+
return typeof v === "string" && v !== "" ? v : null;
|
|
795
|
+
}
|
|
779
796
|
/**
|
|
780
797
|
* Rank candidate rows for a free-text query (FTS5 replacement). Higher is better:
|
|
781
798
|
* exact title, then prefix, then count of matched tokens, with shorter titles and
|
|
@@ -913,7 +930,6 @@ function fetchCoachAthleteWorkouts(client, athleteId, startDate, endDate) {
|
|
|
913
930
|
function fetchCoachAthleteCalendarSummary(client, athleteId, year, month) {
|
|
914
931
|
return getArray(client, `/2.0/coach/athlete/calendar/summary/${athleteId}/${year}/${month}/7`, "coach athlete calendar summary");
|
|
915
932
|
}
|
|
916
|
-
const SLOTS = 10;
|
|
917
933
|
function nonEmpty(value) {
|
|
918
934
|
return value !== void 0 && value !== null && String(value).trim() !== "";
|
|
919
935
|
}
|
|
@@ -924,7 +940,7 @@ function nonEmpty(value) {
|
|
|
924
940
|
*/
|
|
925
941
|
function prescribedSets(ex) {
|
|
926
942
|
const out = [];
|
|
927
|
-
for (let i = 1; i <=
|
|
943
|
+
for (let i = 1; i <= 10; i += 1) {
|
|
928
944
|
const p1 = ex[`param_1_data_${i}`];
|
|
929
945
|
const p2 = ex[`param_2_data_${i}`];
|
|
930
946
|
const has1 = nonEmpty(p1);
|
|
@@ -945,7 +961,7 @@ function prescribedSets(ex) {
|
|
|
945
961
|
*/
|
|
946
962
|
function performedSets(ex) {
|
|
947
963
|
const out = [];
|
|
948
|
-
for (let i = 1; i <=
|
|
964
|
+
for (let i = 1; i <= 10; i += 1) {
|
|
949
965
|
if (coerceInt(ex[`param_${i}_made`]) !== 1) continue;
|
|
950
966
|
const p1 = ex[`param_1_data_${i}`];
|
|
951
967
|
const p2 = ex[`param_2_data_${i}`];
|
|
@@ -979,9 +995,6 @@ function presentBlock(set, performedById) {
|
|
|
979
995
|
exercises: exercises.filter(isRecord).map((ex) => presentExercise(ex, performedById))
|
|
980
996
|
};
|
|
981
997
|
}
|
|
982
|
-
function str$1(v) {
|
|
983
|
-
return typeof v === "string" && v !== "" ? v : null;
|
|
984
|
-
}
|
|
985
998
|
/** Every logged set (programmed + athlete-added) in the saved copy, paired with its exercises. */
|
|
986
999
|
function savedSets(saved) {
|
|
987
1000
|
const out = [];
|
|
@@ -1201,7 +1214,29 @@ function presentCoachAthleteTraining(raw, athleteId, year, month) {
|
|
|
1201
1214
|
sessions
|
|
1202
1215
|
};
|
|
1203
1216
|
}
|
|
1204
|
-
|
|
1217
|
+
/** Flatten `/v5/exercises/{id}/history` into PRs + a session time-series. */
|
|
1218
|
+
function presentExerciseHistory(detail) {
|
|
1219
|
+
return {
|
|
1220
|
+
liftPRs: (detail.liftPRs ?? []).map((p) => ({
|
|
1221
|
+
description: p.description ?? null,
|
|
1222
|
+
reps: p.reps ?? null,
|
|
1223
|
+
weight: p.weight ?? null,
|
|
1224
|
+
units: p.units ?? null,
|
|
1225
|
+
date: p.dateCompleted ?? null
|
|
1226
|
+
})),
|
|
1227
|
+
sessions: (detail.history ?? []).map((h) => ({
|
|
1228
|
+
date: h.dateCompleted,
|
|
1229
|
+
abr: h.abr ?? null,
|
|
1230
|
+
estimated1RM: h.bestEstimated1RM ?? null,
|
|
1231
|
+
sets: (h.sets ?? []).map((s) => ({
|
|
1232
|
+
setNumber: s.setNumber,
|
|
1233
|
+
value: s.formattedValue ?? null
|
|
1234
|
+
}))
|
|
1235
|
+
}))
|
|
1236
|
+
};
|
|
1237
|
+
}
|
|
1238
|
+
//#endregion
|
|
1239
|
+
//#region ../js/src/athlete-set-write.ts
|
|
1205
1240
|
/**
|
|
1206
1241
|
* Coerce the loosely-typed `results` from a validated log/prescribe args object into the SDK's
|
|
1207
1242
|
* {@link SetResult}[]. The dto schemas validate ids as a number or a numeric string and leave
|
|
@@ -1216,10 +1251,11 @@ function toSetResults(results) {
|
|
|
1216
1251
|
return {
|
|
1217
1252
|
savedWorkoutSetExerciseId: id,
|
|
1218
1253
|
sets: r.sets.map((s) => {
|
|
1219
|
-
const
|
|
1220
|
-
if (s.param1 !== void 0)
|
|
1221
|
-
if (s.param2 !== void 0)
|
|
1222
|
-
|
|
1254
|
+
const set = {};
|
|
1255
|
+
if (s.param1 !== void 0) set.param1 = s.param1;
|
|
1256
|
+
if (s.param2 !== void 0) set.param2 = s.param2;
|
|
1257
|
+
if (s.slot !== void 0) set.slot = s.slot;
|
|
1258
|
+
return set;
|
|
1223
1259
|
})
|
|
1224
1260
|
};
|
|
1225
1261
|
});
|
|
@@ -1231,36 +1267,96 @@ function toSetResults(results) {
|
|
|
1231
1267
|
*
|
|
1232
1268
|
* `mode` selects which write this is — the same endpoint serves both:
|
|
1233
1269
|
* - `"log"`: the values ARE a performed result, so `param_N_made` is 1 where the slot has data
|
|
1234
|
-
* and the exercise `completed` flag is 1 when any set has data.
|
|
1270
|
+
* and the exercise `completed` flag is 1 when any set has logged data.
|
|
1235
1271
|
* - `"prescribe"`: the values are prescribed targets, written with every `param_N_made` and
|
|
1236
1272
|
* `completed` left at 0 so the set is not marked done. This matches what the app sends when a
|
|
1237
1273
|
* coach edits an athlete's prescribed reps/weight.
|
|
1238
1274
|
*
|
|
1275
|
+
* Each set fills a 1-based slot: its explicit `slot`, or its sequential position in `results`
|
|
1276
|
+
* when `slot` is omitted. A `log` carrying the live exercise record in `existing` keeps the slots
|
|
1277
|
+
* it does not write that were ALREADY performed (`param_N_made === 1`), so logging a second part of
|
|
1278
|
+
* a set does not wipe the earlier-logged sets. A slot holding only un-logged prescription pre-fill
|
|
1279
|
+
* (`param_N_made === 0`) is left blank rather than carried over: marking the set completed makes
|
|
1280
|
+
* the server flag every data-bearing slot performed, so preserving that pre-fill would fabricate
|
|
1281
|
+
* sets the athlete never did. The prescription is unaffected (it lives in the separate `workout`
|
|
1282
|
+
* copy, not this saved copy). A `prescribe` ignores `existing` and replaces the whole prescription.
|
|
1283
|
+
*
|
|
1239
1284
|
* Only `savedWorkoutSetExerciseId`, `savedWorkoutSetId`, and `workoutSetExerciseId` are
|
|
1240
|
-
* required from the live exercise record; everything else is derived from `results
|
|
1285
|
+
* required from the live exercise record; everything else is derived from `results` and the
|
|
1286
|
+
* preserved slots of `existing`.
|
|
1241
1287
|
*
|
|
1242
1288
|
* Exported for unit testing — callers should use `logAthleteSet` / `prescribeForAthlete` instead.
|
|
1243
1289
|
*/
|
|
1244
|
-
function buildExerciseSetPayload(savedWorkoutSetExerciseId, savedWorkoutSetId, workoutSetExerciseId, results, mode) {
|
|
1245
|
-
if (results.length >
|
|
1290
|
+
function buildExerciseSetPayload(savedWorkoutSetExerciseId, savedWorkoutSetId, workoutSetExerciseId, results, mode, existing) {
|
|
1291
|
+
if (results.length > 10) throw new Error(`At most 10 sets are supported per exercise; got ${results.length}.`);
|
|
1292
|
+
const bySlot = /* @__PURE__ */ new Map();
|
|
1293
|
+
results.forEach((set, i) => {
|
|
1294
|
+
const slot = set.slot ?? i + 1;
|
|
1295
|
+
if (slot < 1 || slot > 10) throw new Error(`Set slot ${slot} is out of range; slots are 1–10.`);
|
|
1296
|
+
if (bySlot.has(slot)) throw new Error(`Two sets target slot ${slot}; each slot can be written once.`);
|
|
1297
|
+
bySlot.set(slot, set);
|
|
1298
|
+
});
|
|
1246
1299
|
const performed = mode === "log";
|
|
1247
|
-
const
|
|
1300
|
+
const carryOver = performed && existing !== void 0;
|
|
1248
1301
|
const body = {
|
|
1249
1302
|
id: savedWorkoutSetExerciseId,
|
|
1250
1303
|
saved_workout_set_id: savedWorkoutSetId,
|
|
1251
|
-
workout_set_exercise_id: workoutSetExerciseId
|
|
1252
|
-
completed: performed && hasData ? 1 : 0
|
|
1304
|
+
workout_set_exercise_id: workoutSetExerciseId
|
|
1253
1305
|
};
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
const
|
|
1257
|
-
|
|
1258
|
-
|
|
1306
|
+
let anyMade = false;
|
|
1307
|
+
for (let i = 1; i <= 10; i += 1) {
|
|
1308
|
+
const target = bySlot.get(i);
|
|
1309
|
+
let p1;
|
|
1310
|
+
let p2;
|
|
1311
|
+
let made;
|
|
1312
|
+
if (target) {
|
|
1313
|
+
p1 = target.param1 !== void 0 ? String(target.param1) : "";
|
|
1314
|
+
p2 = target.param2 !== void 0 ? String(target.param2) : "";
|
|
1315
|
+
made = performed && (p1 !== "" || p2 !== "") ? 1 : 0;
|
|
1316
|
+
} else if (carryOver && coerceInt(existing?.[`param_${i}_made`]) === 1) {
|
|
1317
|
+
p1 = existingSlotData(existing, `param_1_data_${i}`);
|
|
1318
|
+
p2 = existingSlotData(existing, `param_2_data_${i}`);
|
|
1319
|
+
made = 1;
|
|
1320
|
+
} else {
|
|
1321
|
+
p1 = "";
|
|
1322
|
+
p2 = "";
|
|
1323
|
+
made = 0;
|
|
1324
|
+
}
|
|
1325
|
+
if (made === 1) anyMade = true;
|
|
1326
|
+
body[`param_${i}_made`] = made;
|
|
1259
1327
|
body[`param_1_data_${i}`] = p1;
|
|
1260
1328
|
body[`param_2_data_${i}`] = p2;
|
|
1261
1329
|
}
|
|
1330
|
+
body.completed = performed && anyMade ? 1 : 0;
|
|
1262
1331
|
return body;
|
|
1263
1332
|
}
|
|
1333
|
+
/** Read a saved-copy slot value (`param_1_data_N` / `param_2_data_N`) as the string the body uses. */
|
|
1334
|
+
function existingSlotData(existing, key) {
|
|
1335
|
+
const v = existing?.[key];
|
|
1336
|
+
return v === void 0 || v === null ? "" : String(v);
|
|
1337
|
+
}
|
|
1338
|
+
/** True when a saved-copy exercise already carries a performed slot (any `param_N_made` === 1). */
|
|
1339
|
+
function exerciseHasLoggedData(ex) {
|
|
1340
|
+
for (let i = 1; i <= 10; i += 1) if (coerceInt(ex[`param_${i}_made`]) === 1) return true;
|
|
1341
|
+
return false;
|
|
1342
|
+
}
|
|
1343
|
+
/** True when a result carries at least one non-empty param value (so it produces a performed slot). */
|
|
1344
|
+
function resultHasData(result) {
|
|
1345
|
+
return result.sets.some((s) => s.param1 !== void 0 && String(s.param1) !== "" || s.param2 !== void 0 && String(s.param2) !== "");
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Whether every exercise in a saved workout set now has logged data — either written with data in
|
|
1349
|
+
* this call (`loggedIds`) or already carrying a performed slot. Gates the set-completion PUT: a
|
|
1350
|
+
* superset/circuit stays open until the last exercise is logged, so completing it on a partial log
|
|
1351
|
+
* does not flip its still-empty siblings to "done". An exercise written with only empty values does
|
|
1352
|
+
* not count (it would not be marked performed), so an all-empty log never completes the set.
|
|
1353
|
+
*/
|
|
1354
|
+
function isSetFullyLogged(exercises, loggedIds) {
|
|
1355
|
+
return exercises.every((ex) => {
|
|
1356
|
+
const id = coerceInt(ex.id);
|
|
1357
|
+
return id !== null && loggedIds.has(id) || exerciseHasLoggedData(ex);
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1264
1360
|
/**
|
|
1265
1361
|
* Locate the target saved workout set across all program workouts on the given day.
|
|
1266
1362
|
* Returns the `savedWorkoutId`, the matching set's `workoutSetExercises` array so callers
|
|
@@ -1359,7 +1455,8 @@ async function logAthleteSet(client, args) {
|
|
|
1359
1455
|
const r = await writeSetResults(client, { role: "athlete" }, await fetchAthleteWorkouts(client, args.date, args.date), args.savedWorkoutSetId, args.results, "log");
|
|
1360
1456
|
return {
|
|
1361
1457
|
savedWorkoutSetId: r.savedWorkoutSetId,
|
|
1362
|
-
exercisesLogged: r.exercisesWritten
|
|
1458
|
+
exercisesLogged: r.exercisesWritten,
|
|
1459
|
+
setCompleted: r.setCompleted
|
|
1363
1460
|
};
|
|
1364
1461
|
}
|
|
1365
1462
|
/**
|
|
@@ -1380,7 +1477,8 @@ async function logForAthlete(client, args) {
|
|
|
1380
1477
|
}, workouts, args.savedWorkoutSetId, args.results, "log");
|
|
1381
1478
|
return {
|
|
1382
1479
|
savedWorkoutSetId: r.savedWorkoutSetId,
|
|
1383
|
-
exercisesLogged: r.exercisesWritten
|
|
1480
|
+
exercisesLogged: r.exercisesWritten,
|
|
1481
|
+
setCompleted: r.setCompleted
|
|
1384
1482
|
};
|
|
1385
1483
|
}
|
|
1386
1484
|
/**
|
|
@@ -1475,7 +1573,7 @@ async function writeSetResults(client, target, workouts, savedWorkoutSetId, resu
|
|
|
1475
1573
|
const workoutSetExerciseId = coerceInt(ex.workout_set_exercise_id);
|
|
1476
1574
|
if (!workoutSetExerciseId) throw new Error(`savedWorkoutSetExercise ${result.savedWorkoutSetExerciseId} is missing its workout_set_exercise_id (the prescription-template pointer the write needs). This is the savedWorkoutSetExerciseId, not an exercise_id — re-read the ids from athlete_saved_workouts.`);
|
|
1477
1575
|
const body = {
|
|
1478
|
-
...buildExerciseSetPayload(result.savedWorkoutSetExerciseId, savedWorkoutSetId, workoutSetExerciseId, result.sets, mode),
|
|
1576
|
+
...buildExerciseSetPayload(result.savedWorkoutSetExerciseId, savedWorkoutSetId, workoutSetExerciseId, result.sets, mode, ex),
|
|
1479
1577
|
...extra
|
|
1480
1578
|
};
|
|
1481
1579
|
const res = await client.request("PUT", `/1.0/${target.role}/savedworkoutsetexercise/${result.savedWorkoutSetExerciseId}${suffix}`, { body });
|
|
@@ -1485,17 +1583,22 @@ async function writeSetResults(client, target, workouts, savedWorkoutSetId, resu
|
|
|
1485
1583
|
}
|
|
1486
1584
|
exercisesWritten += 1;
|
|
1487
1585
|
}
|
|
1586
|
+
let setCompleted = false;
|
|
1488
1587
|
if (mode === "log") {
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1588
|
+
if (isSetFullyLogged(exercises, new Set(results.filter(resultHasData).map((r) => r.savedWorkoutSetExerciseId)))) {
|
|
1589
|
+
const setBody = {
|
|
1590
|
+
...buildSetCompletePayload(rawSet, exercises.map((e) => coerceInt(e.id)).filter((n) => n !== null), true),
|
|
1591
|
+
...extra
|
|
1592
|
+
};
|
|
1593
|
+
const setRes = await client.request("PUT", `/1.0/${target.role}/savedworkoutset/${savedWorkoutSetId}${suffix}`, { body: setBody });
|
|
1594
|
+
if (!setRes.ok) throw new Error(`Failed to mark workout set ${savedWorkoutSetId} completed (HTTP ${setRes.status}).`);
|
|
1595
|
+
setCompleted = true;
|
|
1596
|
+
}
|
|
1495
1597
|
}
|
|
1496
1598
|
return {
|
|
1497
1599
|
savedWorkoutSetId,
|
|
1498
|
-
exercisesWritten
|
|
1600
|
+
exercisesWritten,
|
|
1601
|
+
setCompleted
|
|
1499
1602
|
};
|
|
1500
1603
|
}
|
|
1501
1604
|
/** Flatten a day's prescribed saved sets into `{ savedWorkoutSetId, ex }` rows (both set keys). */
|
|
@@ -1571,7 +1674,10 @@ async function logResolvedExercises(client, target, date, resolved) {
|
|
|
1571
1674
|
savedWorkoutSetId,
|
|
1572
1675
|
results
|
|
1573
1676
|
});
|
|
1574
|
-
out.push(
|
|
1677
|
+
out.push({
|
|
1678
|
+
savedWorkoutSetId: written.savedWorkoutSetId,
|
|
1679
|
+
exercisesLogged: written.exercisesLogged
|
|
1680
|
+
});
|
|
1575
1681
|
}
|
|
1576
1682
|
return out;
|
|
1577
1683
|
}
|
|
@@ -1610,27 +1716,6 @@ async function logSessionForAthlete(client, args) {
|
|
|
1610
1716
|
sets
|
|
1611
1717
|
};
|
|
1612
1718
|
}
|
|
1613
|
-
/** Flatten `/v5/exercises/{id}/history` into PRs + a session time-series. */
|
|
1614
|
-
function presentExerciseHistory(detail) {
|
|
1615
|
-
return {
|
|
1616
|
-
liftPRs: (detail.liftPRs ?? []).map((p) => ({
|
|
1617
|
-
description: p.description ?? null,
|
|
1618
|
-
reps: p.reps ?? null,
|
|
1619
|
-
weight: p.weight ?? null,
|
|
1620
|
-
units: p.units ?? null,
|
|
1621
|
-
date: p.dateCompleted ?? null
|
|
1622
|
-
})),
|
|
1623
|
-
sessions: (detail.history ?? []).map((h) => ({
|
|
1624
|
-
date: h.dateCompleted,
|
|
1625
|
-
abr: h.abr ?? null,
|
|
1626
|
-
estimated1RM: h.bestEstimated1RM ?? null,
|
|
1627
|
-
sets: (h.sets ?? []).map((s) => ({
|
|
1628
|
-
setNumber: s.setNumber,
|
|
1629
|
-
value: s.formattedValue ?? null
|
|
1630
|
-
}))
|
|
1631
|
-
}))
|
|
1632
|
-
};
|
|
1633
|
-
}
|
|
1634
1719
|
/** Normalize one-or-many emails into a deduped, trimmed list. */
|
|
1635
1720
|
function emailList(emails) {
|
|
1636
1721
|
return [...new Set(emails.map((e) => e.trim()).filter((e) => e.length > 0))];
|
|
@@ -3071,7 +3156,7 @@ function registerAthleteLogTools(server, ctx) {
|
|
|
3071
3156
|
registerAthleteSavedWorkouts(server, ctx);
|
|
3072
3157
|
server.registerTool("log_athlete_set", {
|
|
3073
3158
|
title: "Log set results for a roster athlete",
|
|
3074
|
-
description: "Coach-facing write: record entered results (reps/weight per set) for one of a roster athlete's saved workout sets on a given day
|
|
3159
|
+
description: "Coach-facing write: record entered results (reps/weight per set) for one of a roster athlete's saved workout sets on a given day — the API equivalent of the app's \"Log for Athlete\". Writes to that athlete's training log and shows in their history. Each set fills the next position in order; give a set a 1-based `slot` to place it at a specific position. A partial log records only the positions you send (plus any logged earlier) and leaves the rest unlogged. In a superset/circuit the block is marked done only once every exercise in it has logged results (the response's `setCompleted` reports whether it was). Get athleteId from list_athletes; get savedWorkoutSetId + savedWorkoutSetExerciseId from athlete_saved_workouts for that athlete/day (its default view carries both — pass programId there if the athlete is on several programs). Seeded demo athletes are read-only and will fail; use a real (invited) athlete. Requires confirmation (elicitation or confirm:true).",
|
|
3075
3160
|
inputSchema: {
|
|
3076
3161
|
...coachLogSetArgsSchema.shape,
|
|
3077
3162
|
confirm: z.boolean().optional()
|
|
@@ -3572,7 +3657,7 @@ var JsonFileLibraryCache = class {
|
|
|
3572
3657
|
};
|
|
3573
3658
|
//#endregion
|
|
3574
3659
|
//#region package.json
|
|
3575
|
-
var version = "1.
|
|
3660
|
+
var version = "1.5.0";
|
|
3576
3661
|
//#endregion
|
|
3577
3662
|
//#region src/server.ts
|
|
3578
3663
|
async function main() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trainheroic-unofficial/coach-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
23
23
|
"zod": "^4.4.3",
|
|
24
|
-
"@trainheroic-unofficial/core": "1.
|
|
25
|
-
"@trainheroic-unofficial/js": "1.
|
|
24
|
+
"@trainheroic-unofficial/core": "1.5.0",
|
|
25
|
+
"@trainheroic-unofficial/js": "1.5.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^26.0.0",
|