examples: MRTR backwards-compatibility exploration demos#1597
Draft
examples: MRTR backwards-compatibility exploration demos#1597
Conversation
Three side-by-side demo servers exploring the migration story for
existing `await elicitInput()`-style handlers under the MRTR SEP
(transports-wg#12), bucketed by migration cost:
1. Simple retry — idempotent; mechanical inversion to
'check inputResponses, else return IncompleteResult'
2. Continuation state — multi-step dialogue; handler becomes a
re-entrant state machine threading requestState through the client
3. Persistent — mutation before elicitation; MRTR alone cannot
rescue this, must migrate to Tasks workflow
Each demo registers <name>_before (today's pattern) and <name>_after
(MRTR pattern) so the diff is visible in one file.
The SDK doesn't have the real types yet so shims.ts stubs
IncompleteResult/InputRequests and carries the MRTR params via a
reserved `arguments._mrtr` key as a transport stand-in.
Relates to the backwards-compatibility discussion at
modelcontextprotocol/transports-wg#12
|
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
… growth Companion to 02ContinuationState.ts. Where 02 shows conditional branching (second question depends on first answer), 04 shows linear accumulation: a fixed three-step wizard where requestState grows monotonically each round (route → route+dates → full itinerary). This is the more common shape of multi-elicitation tool in practice (booking flows, setup wizards, onboarding), and the migration is correspondingly simpler — a flat chain of 'have X yet? ask for X' checks with no branching logic. Also highlights that prompts referencing prior answers (e.g. 'dates for LHR → SFO?') work identically under MRTR: the data just comes from decoded requestState instead of closure variables.
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three side-by-side demo servers exploring the backwards-compatibility story for existing
await elicitInput()-style tool handlers under the MRTR SEP (transports-wg#12).This is a direct response to the review discussion at line ~1160 ("this 'ideally' is doing a lot of heavy lifting … we need to figure out what's happening here").
Classification
requestState?Each demo registers
<name>_before(today's pattern) and<name>_after(MRTR pattern) on the same server, so you can diff the handler bodies directly.Files
shims.ts— stand-in types forIncompleteResult,InputRequests/InputResponses; MRTR params ride onarguments._mrtruntil the SDK threads them through natively.01SimpleRetry.ts— weather lookup; migration is essentially mechanical.02ContinuationState.ts— ADO-style cascading required fields (mirrors the SEP's real-world example).03TasksMigration.ts— VM provisioning with a mutation before elicitation; sketches the Tasks shape, defers full plumbing tosimpleTaskInteractive.ts.README.md— decision tree + rationale.Not in scope
This is exploratory / not intended to merge as-is. Goal is to make the three migration buckets concrete enough to discuss which (if any) an SDK-level backcompat layer can automate.