Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

mcp: get_routine reports an exercise's own rest

TheophileDiot3214dfde9d9e
diff --git a/mcp/README.md b/mcp/README.md
index 0cff276ed..7c15cab28 100644
--- a/mcp/README.md
+++ b/mcp/README.md
@@ -72,7 +72,7 @@ Eight read-only tools in v1:
| Tool | What it answers |
|---|---|
| `list_routines` | What routines are saved in my profile? (names + exercise counts) |
-| `get_routine` | What does the Push Day routine prescribe? (sets/reps/weight per exercise) |
+| `get_routine` | What does the Push Day routine prescribe? (sets/reps/weight and rest per exercise) |
| `get_week_plan` | What's on my plan this week, including today with any date-specific override? |
| `list_workouts` | Recent sessions — newest first, with dates, sets done/planned, volume, duration, PRs. |
| `get_workout` | Full set-by-set breakdown of one session, by `workout_id` or by date. On a day with two sessions the date alone returns both ids to pick from rather than guessing at one. |
diff --git a/mcp/src/tools.js b/mcp/src/tools.js
index 3d20b40fc..c7b232354 100644
--- a/mcp/src/tools.js
+++ b/mcp/src/tools.js
@@ -105,7 +105,7 @@ export const listRoutines = {
/** get_routine — the full exercise list for one routine, including set/rep targets. */
export const getRoutine = {
name: 'get_routine',
- description: 'Get the full exercise list for a single routine (the same view the routine editor shows). Returns mode (reps/time/cardio), set/rep/weight targets, superset links, and any per-exercise custom increment you can override. Use routine_id from list_routines.',
+ description: 'Get the full exercise list for a single routine (the same view the routine editor shows). Returns mode (reps/time/cardio), set/rep/weight targets, superset links, any per-exercise custom increment you can override, and each exercise\'s own rest in seconds (absent means it inherits the global rest timer). Use routine_id from list_routines.',
schema: { routine_id: z.string().min(1) },
handler: ({ routine_id }) => {
const S = getState()
@@ -138,6 +138,9 @@ export const getRoutine = {
speed: mode === 'cardio' ? (cfg.speed || 0) : undefined,
weight: cfg.weight != null ? cfg.weight : undefined,
increment: cfg.inc != null ? cfg.inc : undefined,
+ // The exercise's own rest (issue #10). Absent means it inherits the global rest
+ // timer; a superset rests once, taking the longest its members ask for.
+ rest_sec: cfg.restSec > 0 ? cfg.restSec : undefined,
policy: policyFor(cfg, r, mode),
policy_override: cfg.prog || null,
superset_group: cfg.sg || null,
diff --git a/mcp/test/tools.test.js b/mcp/test/tools.test.js
index 7b6e48060..6e36ee731 100644
--- a/mcp/test/tools.test.js
+++ b/mcp/test/tools.test.js
@@ -129,6 +129,17 @@ describe('get_routine', () => {
expect(r.exercises[0]).toMatchObject({ reps: 8, reps_min: 8, reps_max: 12 })
})
+ test('reports an exercise\'s own rest, and leaves it out when it inherits the timer', () => {
+ S.routines[0].ex[0].restSec = 180
+ delete S.routines[0].ex[1]?.restSec
+
+ const r = call('get_routine', { routine_id: S.routines[0].id })
+ expect(r.exercises[0].rest_sec).toBe(180)
+ // An exercise with no rest of its own inherits the global timer. Absent says that;
+ // a zero would read as "no rest at all", which is a different prescription.
+ expect(JSON.parse(JSON.stringify(r)).exercises[1]).not.toHaveProperty('rest_sec')
+ })
+
test('projects routine and exercise progression rules from prog', () => {
S.routines[0].prog = 'greyskull'
S.routines[0].ex[0].prog = 'double'