Skip to content

fix(mcp): preview_session builds a custom exercise as the app does - #412

Merged
DuarteSantos8 merged 1 commit into
DuarteSantos8:mainfrom
kurktchiev:gh/mcp-preview-customs
Oct 9, 2026
Merged

DuarteSantos8 merged 1 commit into
DuarteSantos8:mainfrom
kurktchiev:gh/mcp-preview-customs

Conversation

@kurktchiev

@kurktchiev kurktchiev commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

preview_session is the tool to call before telling someone what they are about to lift, and it builds the session with the app's own buildSessionEntries. That builder reads each exercise's equipment and body part from the global exercise index. The app registers custom exercises there at store load (registerCustom); the MCP server deliberately never does (the comment above customOf in tools.js explains why), so to the builder a custom exercise had no body part at all.

What that changed in the preview: a custom leg lift ramped its warm-ups on the 2.5 kg step instead of the 5 kg one the app takes for legs. A custom hack squat at 90 kg with two warm-up sets previewed as 45 / 67.5; the app opens it at 45 / 65.

preview_session now registers the profile's custom exercises for the length of that one synchronous build and removes them again before it returns (withCustomsIndexed, a try/finally). No other read can run in between, so the reason the server keeps customs out of the index still holds, and a test checks the index is left as it was.

Tests: one new test in mcp/test/tools.test.js (the 90 kg case above). It fails without the change (45, 67.5) and passes with it. The whole mcp suite passes on 39bc71e, and npm run check:node-loadable still loads the full import graph under plain Node.

No open PR gains a conflict from this branch.

🤖 Generated with Claude Code

The session builder reads each exercise's equipment and body part from
the global exercise index. The server never registers custom exercises
there (tools.js customOf explains why), so preview_session built a custom
leg lift on the small load step (2.5 kg instead of 5 kg for a barbell
lift's warm-ups, 45/67.5 instead of the app's 45/65 at 90 kg), where the
app, which registers its customs at store load, takes the larger one.

preview_session now registers the profile's customs for the length of
the one synchronous build and removes them again in the same call, so no
other read sees them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@kurktchiev
kurktchiev force-pushed the gh/mcp-preview-customs branch from 25325ea to 5859d5e Compare October 7, 2026 17:25
crstnmac added a commit to crstnmac/openGym that referenced this pull request Oct 9, 2026
@DuarteSantos8
DuarteSantos8 merged commit 7fd349e into DuarteSantos8:main Oct 9, 2026
4 checks passed
@kurktchiev
kurktchiev deleted the gh/mcp-preview-customs branch October 9, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants