@trainheroic-unofficial/coach-mcp 1.1.1 → 1.2.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.
Files changed (2) hide show
  1. package/dist/server.mjs +218 -45
  2. package/package.json +3 -3
package/dist/server.mjs CHANGED
@@ -163,17 +163,43 @@ const loggedSetSchema = z.object({
163
163
  param2: z.union([z.number(), z.string()]).optional()
164
164
  });
165
165
  /**
166
- * Args for the coach "log for athlete" write — the same shape as logSetArgsSchema plus the
167
- * roster `athleteId` whose set is being logged on their behalf.
166
+ * Args for the set-logging write. `date` (the workout's day) locates the saved
167
+ * workout via the range endpoint; `savedWorkoutSetId` picks the set to complete; `results`
168
+ * gives, per exercise in it, the entered value of each set (param 1 / param 2 by entry slot).
168
169
  */
169
- const coachLogSetArgsSchema = z.object({
170
+ const logSetArgsSchema = z.object({
170
171
  date: dateString,
171
172
  savedWorkoutSetId: idArgSchema,
172
173
  results: z.array(z.object({
173
174
  savedWorkoutSetExerciseId: idArgSchema,
174
175
  sets: z.array(loggedSetSchema).min(1)
175
176
  })).min(1)
176
- }).extend({ athleteId: idArgSchema });
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 });
183
+ /**
184
+ * Args for the coach prescription-override write. Structurally the same as
185
+ * {@link coachLogSetArgsSchema} (athleteId + date + savedWorkoutSetId + per-exercise `sets`), but
186
+ * the values are prescribed targets (param1 = reps, param2 = weight) written to the athlete's
187
+ * plan without marking the set performed. It is a separate schema (not an alias) so a future
188
+ * prescribe-only constraint can be added here without changing the log args, and the write
189
+ * replaces the slot's prescribed values for this athlete only.
190
+ */
191
+ const coachPrescribeSetArgsSchema = logSetArgsSchema.extend({ athleteId: idArgSchema });
192
+ /**
193
+ * Args for the coach per-athlete exercise swap: replace the exercise prescribed in one of a
194
+ * roster athlete's saved-workout slots with a different exercise, the API equivalent of the
195
+ * app's per-athlete "swap exercise". `savedWorkoutSetExerciseId` is that athlete's own slot id
196
+ * (the same id `coachLogSetArgsSchema` uses, read off athlete_saved_workouts raw);
197
+ * `exerciseId` is the replacement exercise. The team/program prescription is left untouched.
198
+ */
199
+ const swapAthleteExerciseArgsSchema = z.object({
200
+ savedWorkoutSetExerciseId: idArgSchema,
201
+ exerciseId: idArgSchema
202
+ });
177
203
  /**
178
204
  * Args for the coach variant of {@link logSessionArgsSchema}: the same shape plus the roster
179
205
  * `athleteId` whose session is being logged on their behalf.
@@ -1052,29 +1078,59 @@ function presentCoachAthleteTraining(raw, athleteId, year, month) {
1052
1078
  }
1053
1079
  const MAX_PARAM_SLOTS = 10;
1054
1080
  /**
1055
- * Build the body for `PUT /1.0/athlete/savedworkoutsetexercise/{id}`. The body uses
1056
- * snake_case keys matching the live API response shape. Each set slot (1-10) gets a
1057
- * `param_N_made` flag (1 if data is present, 0 otherwise) and `param_1_data_N` /
1058
- * `param_2_data_N` string values.
1081
+ * Coerce the loosely-typed `results` from a validated log/prescribe args object into the SDK's
1082
+ * {@link SetResult}[]. The dto schemas validate ids as a number or a numeric string and leave
1083
+ * empty param slots optional; this narrows the id to a number and copies only the present per-set
1084
+ * values (so the per-set type stays free of `undefined` under exactOptionalPropertyTypes). Shared
1085
+ * by the MCP tools and the CLI so the mapping lives in one place rather than once per surface.
1086
+ */
1087
+ function toSetResults(results) {
1088
+ return results.map((r) => {
1089
+ const id = coerceInt(r.savedWorkoutSetExerciseId);
1090
+ if (id === null) throw new Error(`Invalid savedWorkoutSetExerciseId: ${String(r.savedWorkoutSetExerciseId)}`);
1091
+ return {
1092
+ savedWorkoutSetExerciseId: id,
1093
+ sets: r.sets.map((s) => {
1094
+ const slot = {};
1095
+ if (s.param1 !== void 0) slot.param1 = s.param1;
1096
+ if (s.param2 !== void 0) slot.param2 = s.param2;
1097
+ return slot;
1098
+ })
1099
+ };
1100
+ });
1101
+ }
1102
+ /**
1103
+ * Build the body for `PUT /1.0/{role}/savedworkoutsetexercise/{id}`. The body uses snake_case
1104
+ * keys matching the live API response shape. Each set slot (1-10) carries `param_1_data_N` /
1105
+ * `param_2_data_N` string values plus a `param_N_made` flag.
1106
+ *
1107
+ * `mode` selects which write this is — the same endpoint serves both:
1108
+ * - `"log"`: the values ARE a performed result, so `param_N_made` is 1 where the slot has data
1109
+ * and the exercise `completed` flag is 1 when any set has data.
1110
+ * - `"prescribe"`: the values are prescribed targets, written with every `param_N_made` and
1111
+ * `completed` left at 0 so the set is not marked done. This matches what the app sends when a
1112
+ * coach edits an athlete's prescribed reps/weight.
1059
1113
  *
1060
1114
  * Only `savedWorkoutSetExerciseId`, `savedWorkoutSetId`, and `workoutSetExerciseId` are
1061
1115
  * required from the live exercise record; everything else is derived from `results`.
1062
1116
  *
1063
- * Exported for unit testing — callers should use `logAthleteSet` instead.
1117
+ * Exported for unit testing — callers should use `logAthleteSet` / `prescribeForAthlete` instead.
1064
1118
  */
1065
- function buildExerciseLogPayload(savedWorkoutSetExerciseId, savedWorkoutSetId, workoutSetExerciseId, results) {
1119
+ function buildExerciseSetPayload(savedWorkoutSetExerciseId, savedWorkoutSetId, workoutSetExerciseId, results, mode) {
1066
1120
  if (results.length > MAX_PARAM_SLOTS) throw new Error(`At most ${MAX_PARAM_SLOTS} sets are supported per exercise; got ${results.length}.`);
1121
+ const performed = mode === "log";
1122
+ const hasData = results.some((s) => s.param1 !== void 0 || s.param2 !== void 0);
1067
1123
  const body = {
1068
1124
  id: savedWorkoutSetExerciseId,
1069
1125
  saved_workout_set_id: savedWorkoutSetId,
1070
1126
  workout_set_exercise_id: workoutSetExerciseId,
1071
- completed: results.some((s) => s.param1 !== void 0 || s.param2 !== void 0) ? 1 : 0
1127
+ completed: performed && hasData ? 1 : 0
1072
1128
  };
1073
1129
  for (let i = 1; i <= MAX_PARAM_SLOTS; i += 1) {
1074
1130
  const slot = results[i - 1];
1075
1131
  const p1 = slot?.param1 !== void 0 ? String(slot.param1) : "";
1076
1132
  const p2 = slot?.param2 !== void 0 ? String(slot.param2) : "";
1077
- body[`param_${i}_made`] = p1 !== "" || p2 !== "" ? 1 : 0;
1133
+ body[`param_${i}_made`] = performed && (p1 !== "" || p2 !== "") ? 1 : 0;
1078
1134
  body[`param_1_data_${i}`] = p1;
1079
1135
  body[`param_2_data_${i}`] = p2;
1080
1136
  }
@@ -1175,7 +1231,11 @@ function buildSetCompletePayload(rawSet, exerciseIds, complete) {
1175
1231
  * by the respective PUT bodies.
1176
1232
  */
1177
1233
  async function logAthleteSet(client, args) {
1178
- return writeSetResults(client, { role: "athlete" }, await fetchAthleteWorkouts(client, args.date, args.date), args.savedWorkoutSetId, args.results);
1234
+ const r = await writeSetResults(client, { role: "athlete" }, await fetchAthleteWorkouts(client, args.date, args.date), args.savedWorkoutSetId, args.results, "log");
1235
+ return {
1236
+ savedWorkoutSetId: r.savedWorkoutSetId,
1237
+ exercisesLogged: r.exercisesWritten
1238
+ };
1179
1239
  }
1180
1240
  /**
1181
1241
  * Coach "Log for Athlete": record set results for a roster athlete on their behalf, via the
@@ -1189,24 +1249,94 @@ async function logAthleteSet(client, args) {
1189
1249
  */
1190
1250
  async function logForAthlete(client, args) {
1191
1251
  const workouts = await fetchCoachAthleteWorkouts(client, args.athleteId, args.date, args.date);
1192
- return writeSetResults(client, {
1252
+ const r = await writeSetResults(client, {
1193
1253
  role: "coach",
1194
1254
  athleteId: args.athleteId
1195
- }, workouts, args.savedWorkoutSetId, args.results);
1255
+ }, workouts, args.savedWorkoutSetId, args.results, "log");
1256
+ return {
1257
+ savedWorkoutSetId: r.savedWorkoutSetId,
1258
+ exercisesLogged: r.exercisesWritten
1259
+ };
1260
+ }
1261
+ /**
1262
+ * Coach prescription override: set the prescribed reps/weight for one of a roster athlete's saved
1263
+ * workout sets WITHOUT marking it performed — the API equivalent of the app's editing an athlete's
1264
+ * prescribed values. Writes each exercise's per-set targets via
1265
+ * `PUT /1.0/coach/savedworkoutsetexercise/{id}/{athleteId}` with `param_N_made = 0` /
1266
+ * `completed = 0`, and (unlike {@link logForAthlete}) skips the set-completion step, so the set
1267
+ * stays open for the athlete to log against.
1268
+ *
1269
+ * Overrides only this athlete's copy of the set; the team/program prescription is untouched, so
1270
+ * other athletes on the same program keep the original targets. The write REPLACES the slot's
1271
+ * prescribed values, so pass the full per-set prescription you want — `param1` is reps, `param2`
1272
+ * is weight, and an omitted param is written empty (clearing it), not left as-is.
1273
+ *
1274
+ * NOTE: TrainHeroic's seeded *demo* athletes are read-only and return 401/403; real (invited)
1275
+ * athletes accept it.
1276
+ */
1277
+ async function prescribeForAthlete(client, args) {
1278
+ const workouts = await fetchCoachAthleteWorkouts(client, args.athleteId, args.date, args.date);
1279
+ const r = await writeSetResults(client, {
1280
+ role: "coach",
1281
+ athleteId: args.athleteId
1282
+ }, workouts, args.savedWorkoutSetId, args.results, "prescribe");
1283
+ return {
1284
+ savedWorkoutSetId: r.savedWorkoutSetId,
1285
+ exercisesPrescribed: r.exercisesWritten
1286
+ };
1287
+ }
1288
+ /**
1289
+ * Swap the exercise prescribed in one of an athlete's saved-workout slots for a different
1290
+ * exercise — the API equivalent of the app's per-athlete "swap exercise":
1291
+ * `PUT /v5/savedWorkoutSetExercises/{savedWorkoutSetExerciseId}?exerciseId={exerciseId}` with an
1292
+ * empty body. The new exercise rides in the query string, not the body.
1293
+ *
1294
+ * This overrides only this athlete's copy of the slot; the underlying team/program prescription
1295
+ * (`workout_set_exercise.exercise_id`) is untouched, so other athletes on the same program keep
1296
+ * the original exercise. A coach's session token may write another user's row because the row
1297
+ * already carries its owner's `user_id`.
1298
+ *
1299
+ * `savedWorkoutSetExerciseId` is the same id {@link logForAthlete}/{@link logAthleteSet} use,
1300
+ * read off the athlete's saved workouts (the raw view). `exerciseId` is any exercise id the org
1301
+ * can use (resolve one via the exercise index).
1302
+ *
1303
+ * NOTE: as with logging, TrainHeroic's seeded *demo* athletes are read-only and return 401/403;
1304
+ * real (invited) athletes accept the swap.
1305
+ */
1306
+ async function swapAthleteExercise(client, args) {
1307
+ const res = await client.request("PUT", `/v5/savedWorkoutSetExercises/${args.savedWorkoutSetExerciseId}?exerciseId=${args.exerciseId}`);
1308
+ if (!res.ok) {
1309
+ const readOnly = res.status === 401 || res.status === 403 ? ` Athlete may be read-only for changes — TrainHeroic's seeded demo/sample athletes return ${res.status} here; swaps only persist for real (invited) athletes.` : "";
1310
+ throw new Error(`Swap failed (HTTP ${res.status}) for savedWorkoutSetExercise ${args.savedWorkoutSetExerciseId}.${readOnly}`);
1311
+ }
1312
+ const row = isRecord(res.data) ? res.data : {};
1313
+ const template = isRecord(row.workout_set_exercise) ? row.workout_set_exercise : {};
1314
+ const exercise = isRecord(row.exercise) ? row.exercise : {};
1315
+ return {
1316
+ savedWorkoutSetExerciseId: args.savedWorkoutSetExerciseId,
1317
+ athleteId: coerceInt(row.user_id),
1318
+ newExerciseId: coerceInt(row.exercise_id) ?? args.exerciseId,
1319
+ newExerciseTitle: str$1(exercise.title),
1320
+ originalTeamExerciseId: coerceInt(template.exercise_id)
1321
+ };
1196
1322
  }
1197
1323
  /**
1198
- * Shared two-step set-log write behind {@link logAthleteSet} and {@link logForAthlete}.
1199
- * `target` selects the surface: `athlete` writes `/1.0/athlete/...`; `coach` writes
1200
- * `/1.0/coach/...{athleteId}` and stamps `athleteId` into each body. Step 1 PUTs each
1201
- * exercise's entered data to its own endpoint (the only path that actually stores reps and
1202
- * weight). Step 2 marks the set completed; that body needs the app's camelCase in-memory
1203
- * shape and the full list of savedWorkoutSetExercise IDs in the set (not only the logged ones).
1324
+ * Shared set-write behind {@link logAthleteSet}, {@link logForAthlete}, and
1325
+ * {@link prescribeForAthlete}. `target` selects the surface: `athlete` writes `/1.0/athlete/...`;
1326
+ * `coach` writes `/1.0/coach/...{athleteId}` and stamps `athleteId` into each body.
1327
+ *
1328
+ * Step 1 PUTs each exercise's per-set values to its own endpoint (the only path that actually
1329
+ * stores reps and weight). `mode` decides what those values mean: `"log"` records them as a
1330
+ * performed result and runs Step 2, which marks the set completed (that body needs the app's
1331
+ * camelCase in-memory shape and the full list of savedWorkoutSetExercise IDs in the set, not only
1332
+ * the written ones); `"prescribe"` writes them as a prescription and skips Step 2, leaving the set
1333
+ * open.
1204
1334
  */
1205
- async function writeSetResults(client, target, workouts, savedWorkoutSetId, results) {
1335
+ async function writeSetResults(client, target, workouts, savedWorkoutSetId, results, mode) {
1206
1336
  const { exercises, rawSet } = findSavedWorkoutSet(workouts, savedWorkoutSetId);
1207
1337
  const suffix = target.role === "coach" ? `/${target.athleteId}` : "";
1208
1338
  const extra = target.role === "coach" ? { athleteId: target.athleteId } : {};
1209
- let exercisesLogged = 0;
1339
+ let exercisesWritten = 0;
1210
1340
  for (const result of results) {
1211
1341
  const ex = exercises.find((e) => coerceInt(e.id) === result.savedWorkoutSetExerciseId);
1212
1342
  if (!ex) {
@@ -1220,25 +1350,27 @@ async function writeSetResults(client, target, workouts, savedWorkoutSetId, resu
1220
1350
  const workoutSetExerciseId = coerceInt(ex.workout_set_exercise_id);
1221
1351
  if (!workoutSetExerciseId) throw new Error(`Could not resolve workout_set_exercise_id for exercise ${result.savedWorkoutSetExerciseId}.`);
1222
1352
  const body = {
1223
- ...buildExerciseLogPayload(result.savedWorkoutSetExerciseId, savedWorkoutSetId, workoutSetExerciseId, result.sets),
1353
+ ...buildExerciseSetPayload(result.savedWorkoutSetExerciseId, savedWorkoutSetId, workoutSetExerciseId, result.sets, mode),
1224
1354
  ...extra
1225
1355
  };
1226
1356
  const res = await client.request("PUT", `/1.0/${target.role}/savedworkoutsetexercise/${result.savedWorkoutSetExerciseId}${suffix}`, { body });
1227
1357
  if (!res.ok) {
1228
- const readOnly = target.role === "coach" && (res.status === 401 || res.status === 403) ? ` Athlete ${target.athleteId} appears to be read-only for results — TrainHeroic's seeded demo/sample athletes return ${res.status} here; results only persist for real (invited) athletes.` : "";
1229
- throw new Error(`Failed to log exercise ${result.savedWorkoutSetExerciseId} (HTTP ${res.status}).${readOnly}`);
1358
+ const readOnly = target.role === "coach" && (res.status === 401 || res.status === 403) ? ` Athlete ${target.athleteId} appears to be read-only for changes — TrainHeroic's seeded demo/sample athletes return ${res.status} here; writes only persist for real (invited) athletes.` : "";
1359
+ throw new Error(`Failed to write exercise ${result.savedWorkoutSetExerciseId} (HTTP ${res.status}).${readOnly}`);
1230
1360
  }
1231
- exercisesLogged += 1;
1361
+ exercisesWritten += 1;
1362
+ }
1363
+ if (mode === "log") {
1364
+ const setBody = {
1365
+ ...buildSetCompletePayload(rawSet, exercises.map((e) => coerceInt(e.id)).filter((n) => n !== null), true),
1366
+ ...extra
1367
+ };
1368
+ const setRes = await client.request("PUT", `/1.0/${target.role}/savedworkoutset/${savedWorkoutSetId}${suffix}`, { body: setBody });
1369
+ if (!setRes.ok) throw new Error(`Failed to mark workout set ${savedWorkoutSetId} completed (HTTP ${setRes.status}).`);
1232
1370
  }
1233
- const setBody = {
1234
- ...buildSetCompletePayload(rawSet, exercises.map((e) => coerceInt(e.id)).filter((n) => n !== null), true),
1235
- ...extra
1236
- };
1237
- const setRes = await client.request("PUT", `/1.0/${target.role}/savedworkoutset/${savedWorkoutSetId}${suffix}`, { body: setBody });
1238
- if (!setRes.ok) throw new Error(`Failed to mark workout set ${savedWorkoutSetId} completed (HTTP ${setRes.status}).`);
1239
1371
  return {
1240
1372
  savedWorkoutSetId,
1241
- exercisesLogged
1373
+ exercisesWritten
1242
1374
  };
1243
1375
  }
1244
1376
  /** Flatten a day's prescribed saved sets into `{ savedWorkoutSetId, ex }` rows (both set keys). */
@@ -2507,6 +2639,8 @@ function registerAthleteTools(server, ctx) {
2507
2639
  }
2508
2640
  }, ({ athleteIds }) => apiCall(ctx, "PUT", "/v5/athletes/restore", { body: { athleteIds: athleteIds.map(toId) } }));
2509
2641
  registerAthleteLogTools(server, ctx);
2642
+ registerAthleteSwapTool(server, ctx);
2643
+ registerAthletePrescribeTool(server, ctx);
2510
2644
  }
2511
2645
  /**
2512
2646
  * Coach "Log for Athlete": read a roster athlete's saved workouts (to get the log ids), then
@@ -2541,20 +2675,11 @@ function registerAthleteLogTools(server, ctx) {
2541
2675
  }, ({ athleteId, date, savedWorkoutSetId, results, confirm }, extra) => attempt(async () => {
2542
2676
  const aId = toId(athleteId);
2543
2677
  if (!await confirmGate(server, extra.requestId, `Log results to athlete ${aId}'s saved workout set ${toId(savedWorkoutSetId)} on ${date}? This writes to their coach-visible training log.`, confirm)) return errorResult(NOT_CONFIRMED);
2544
- const mapped = results.map((r) => ({
2545
- savedWorkoutSetExerciseId: toId(r.savedWorkoutSetExerciseId),
2546
- sets: r.sets.map((s) => {
2547
- const slot = {};
2548
- if (s.param1 !== void 0) slot.param1 = s.param1;
2549
- if (s.param2 !== void 0) slot.param2 = s.param2;
2550
- return slot;
2551
- })
2552
- }));
2553
2678
  return jsonResult(await logForAthlete(ctx.client, {
2554
2679
  athleteId: aId,
2555
2680
  date,
2556
2681
  savedWorkoutSetId: toId(savedWorkoutSetId),
2557
- results: mapped
2682
+ results: toSetResults(results)
2558
2683
  }));
2559
2684
  }));
2560
2685
  server.registerTool("coach_log_session", {
@@ -2575,6 +2700,54 @@ function registerAthleteLogTools(server, ctx) {
2575
2700
  }));
2576
2701
  }));
2577
2702
  }
2703
+ /**
2704
+ * Coach per-athlete exercise swap, kept in its own function so registerAthleteLogTools stays
2705
+ * under the oxlint max-lines-per-function cap.
2706
+ */
2707
+ function registerAthleteSwapTool(server, ctx) {
2708
+ server.registerTool("swap_athlete_exercise", {
2709
+ title: "Swap one exercise in a roster athlete's prescribed workout",
2710
+ description: "Coach-facing write: replace one exercise in a roster athlete's scheduled workout with a different one, for that athlete only — the API equivalent of the app's per-athlete \"swap exercise\". The team/program prescription is left untouched, so other athletes on the same program keep the original exercise. Give savedWorkoutSetExerciseId (the athlete's own slot, from athlete_saved_workouts with raw:true) and exerciseId (the replacement, from exercise_resolve / exercise_search). Seeded demo athletes are read-only and will fail; use a real (invited) athlete. Requires confirmation (elicitation or confirm:true).",
2711
+ inputSchema: {
2712
+ ...swapAthleteExerciseArgsSchema.shape,
2713
+ confirm: z.boolean().optional()
2714
+ },
2715
+ annotations: DESTRUCTIVE
2716
+ }, ({ savedWorkoutSetExerciseId, exerciseId, confirm }, extra) => attempt(async () => {
2717
+ const sweId = toId(savedWorkoutSetExerciseId);
2718
+ const exId = toId(exerciseId);
2719
+ if (!await confirmGate(server, extra.requestId, `Swap the exercise in saved workout slot ${sweId} to exercise ${exId}? This changes what this athlete is prescribed (their copy only).`, confirm)) return errorResult(NOT_CONFIRMED);
2720
+ return jsonResult(await swapAthleteExercise(ctx.client, {
2721
+ savedWorkoutSetExerciseId: sweId,
2722
+ exerciseId: exId
2723
+ }));
2724
+ }));
2725
+ }
2726
+ /**
2727
+ * Coach prescription override, kept in its own function so registerAthleteTools stays under the
2728
+ * oxlint max-lines-per-function cap. Lets a coach set the prescribed reps/weight for one of a
2729
+ * roster athlete's saved workout sets without marking it done — "prescribe weights for an athlete".
2730
+ */
2731
+ function registerAthletePrescribeTool(server, ctx) {
2732
+ server.registerTool("prescribe_athlete_set", {
2733
+ title: "Prescribe reps/weight for a roster athlete's set",
2734
+ description: "Coach-facing write: set the prescribed reps and/or weight for one of a roster athlete's scheduled workout sets, for that athlete only, WITHOUT marking it done — the API equivalent of the app's editing an athlete's prescribed values (\"prescribe weights for an athlete\"). The set stays open for the athlete to log against, and the team/program prescription is left untouched, so other athletes keep the original targets. param1 is reps, param2 is weight; pass one sets[] entry per prescribed set. The write REPLACES the slot's prescribed values (the sets you pass become the whole prescription, and an omitted param is cleared), so give the full per-set prescription you want. Get athleteId from list_athletes; get savedWorkoutSetId + savedWorkoutSetExerciseId from athlete_saved_workouts (raw:true) for that athlete/day. To record a set as PERFORMED instead, use log_athlete_set. Seeded demo athletes are read-only and will fail; use a real (invited) athlete. Requires confirmation (elicitation or confirm:true).",
2735
+ inputSchema: {
2736
+ ...coachPrescribeSetArgsSchema.shape,
2737
+ confirm: z.boolean().optional()
2738
+ },
2739
+ annotations: DESTRUCTIVE
2740
+ }, ({ athleteId, date, savedWorkoutSetId, results, confirm }, extra) => attempt(async () => {
2741
+ const aId = toId(athleteId);
2742
+ if (!await confirmGate(server, extra.requestId, `Set prescribed values on athlete ${aId}'s saved workout set ${toId(savedWorkoutSetId)} on ${date}? This changes what this athlete is prescribed (their copy only); it does not mark the set done.`, confirm)) return errorResult(NOT_CONFIRMED);
2743
+ return jsonResult(await prescribeForAthlete(ctx.client, {
2744
+ athleteId: aId,
2745
+ date,
2746
+ savedWorkoutSetId: toId(savedWorkoutSetId),
2747
+ results: toSetResults(results)
2748
+ }));
2749
+ }));
2750
+ }
2578
2751
  //#endregion
2579
2752
  //#region ../core/src/tools/teams.ts
2580
2753
  const ADDITIVE = {
@@ -2994,7 +3167,7 @@ var JsonFileLibraryCache = class {
2994
3167
  };
2995
3168
  //#endregion
2996
3169
  //#region package.json
2997
- var version = "1.1.1";
3170
+ var version = "1.2.0";
2998
3171
  //#endregion
2999
3172
  //#region src/server.ts
3000
3173
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trainheroic-unofficial/coach-mcp",
3
- "version": "1.1.1",
3
+ "version": "1.2.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.1.1",
25
- "@trainheroic-unofficial/js": "1.1.1"
24
+ "@trainheroic-unofficial/core": "1.2.0",
25
+ "@trainheroic-unofficial/js": "1.2.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^26.0.0",