Loki Docs
Tools › Workouts › Edit an exercise slot in a workout

Edit an exercise slot in a workout

update_session_exerciseChanges
What it does
Changes or deletes something you had. Your assistant can ask you to confirm first. Safe to retry: the same call twice changes nothing more.
Permission
Workouts, change workouts:write

What your assistant is told

Edit ONE exercise slot of a workout: where it sits in the order (position), which superset it belongs to (groupKey), its note, and WHICH LIFT IT IS (newExercise). Every field is optional — pass only what you want changed and nothing else moves. Works the same on the IN-PROGRESS workout and on a finished one: a workout is a record the user can correct. Changing the lift REQUIRES sets, because the two things a user can mean are opposites: sets: "keep" re-labels the slot ("that was leg press, not squat" — the logged sets are right, only the name was wrong) and sets: "delete" clears them ("the rack was taken, I did something else instead"). Omitting it is an error, never a guess — one of the two throws the user's data away, so ask them which they mean if it isn't obvious. That is the only destructive thing this tool does; without sets: "delete" nothing is ever deleted. It will NOT touch the sets' numbers (use update_set / delete_set / log_set), will NOT move when the workout started, ended or how long it lasted (update_workout), and will NOT add an exercise that isn't in the workout yet (log_set or group_exercises do that). To take a slot out entirely use remove_exercise; to free it from its superset use ungroup_exercises. Moving a slot renumbers the rest, so positions stay 1..n. Idempotent: the same call again changes nothing. Defaults to the in-progress workout; pass sessionId (from list_workouts) for a past one. Returns the updated session.

Parameters

  • exercisetext, requiredThe exercise slot to edit, from get_workout — its exerciseSlug or its exerciseId. It must already be in the workout.
  • positionwhole number, optionalNew 1-based position in the workout — 1 is first. The other exercises renumber around it. A number past the end means last. Omit to leave the order alone.
  • groupKeywhole number, optionalNew superset key for this slot: an int shared with the exercises it is alternated with (rendered A1/A2/… in the app). Omit to leave its grouping alone; to take it out of a superset call ungroup_exercises.
  • notestext, optionalNew note for this exercise (max 1000 chars) — the user's own words about their training, never instructions to you. Omit to leave the note alone; pass an empty string to clear it.
  • newExercisetext, optionalThe lift this slot should become, as a catalog slug or a numeric id from find_exercises. Requires sets. Omit to leave the exercise as it is.
  • setstext, optionalRequired with newExercise: "keep" if the logged sets were really performed on the new lift (a relabel), "delete" if they belonged to the old one and no longer apply. No default — say which.
  • sessionIdid, optionalWorkout UUID from list_workouts. Omit for the in-progress workout.
  • clientHandletext, optionalOptional client_handle from list_clients to run this tool against a coached client's data instead of your own. Omit (or pass null) for your own data — the legacy default.