Skip to content

Commit f9fc447

Browse files
rename: optionX prefix for diff reading order
1 parent 1c97bb9 commit f9fc447

7 files changed

Lines changed: 20 additions & 20 deletions

File tree

examples/server/src/mrtr-dual-path/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ Bottom-left is discounted: no amount of SDK work fills it when the server infra
1616

1717
## Options
1818

19-
| | Author writes | SDK does | Hidden re-entry | Old client gets |
20-
| ------------------------------- | ------------------------------- | ------------------------------ | ------------------------------------------- | ------------------------------- |
21-
| [A](./shimMrtrCanonical.ts) | MRTR-native only | Emulates retry loop over SSE | Yes, but safe (guard is explicit in source) | Full elicitation |
22-
| [B](./shimAwaitCanonical.ts) | `await elicit()` only | Exception → `IncompleteResult` | Yes, **unsafe** (invisible in source) | Full elicitation |
23-
| [C](./explicitVersionBranch.ts) | One handler, `if (mrtr)` branch | Version accessor | No | Full elicitation |
24-
| [D](./dualRegistration.ts) | Two handlers | Picks by version | No | Full elicitation |
25-
| [E](./degradeOnly.ts) | MRTR-native only | Nothing | No | Error ("requires newer client") |
19+
| | Author writes | SDK does | Hidden re-entry | Old client gets |
20+
| -------------------------------------- | ------------------------------- | ------------------------------ | ------------------------------------------- | ------------------------------- |
21+
| [A](./optionAShimMrtrCanonical.ts) | MRTR-native only | Emulates retry loop over SSE | Yes, but safe (guard is explicit in source) | Full elicitation |
22+
| [B](./optionBShimAwaitCanonical.ts) | `await elicit()` only | Exception → `IncompleteResult` | Yes, **unsafe** (invisible in source) | Full elicitation |
23+
| [C](./optionCExplicitVersionBranch.ts) | One handler, `if (mrtr)` branch | Version accessor | No | Full elicitation |
24+
| [D](./optionDDualRegistration.ts) | Two handlers | Picks by version | No | Full elicitation |
25+
| [E](./optionEDegradeOnly.ts) | MRTR-native only | Nothing | No | Error ("requires newer client") |
2626

2727
"Hidden re-entry" = the handler function is invoked more than once for a single logical tool call, and the author can't tell from the source text. A is safe because MRTR-native code has the re-entry guard (`if (!prefs) return`) visible in the source even though the _loop_ is
2828
hidden. B is unsafe because `await elicit()` looks like a suspension point but is actually a re-entry point on MRTR sessions — see the `auditLog` landmine in that file.
@@ -45,8 +45,8 @@ the dual-path burden on the tool author rather than the SDK.
4545
All demos use `DEMO_PROTOCOL_VERSION` to simulate the negotiated version, since the real SDK doesn't surface it to handlers yet:
4646

4747
```sh
48-
DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/shimMrtrCanonical.ts
49-
DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/shimMrtrCanonical.ts
48+
DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/optionAShimMrtrCanonical.ts
49+
DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/optionAShimMrtrCanonical.ts
5050
```
5151

5252
`IncompleteResult` is smuggled through the current `registerTool` signature as a JSON text block (same hack as #1597). A real implementation emits `JSONRPCIncompleteResultResponse` at the protocol layer — see `shims.ts:wrap()`.

examples/server/src/mrtr-dual-path/shimMrtrCanonical.ts renamed to examples/server/src/mrtr-dual-path/optionAShimMrtrCanonical.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
* rounds, or does something expensive before the guard, the author won't
1919
* find out until an old client connects in prod. It works, but it's magic.
2020
*
21-
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/shimMrtrCanonical.ts
22-
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/shimMrtrCanonical.ts
21+
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/optionAShimMrtrCanonical.ts
22+
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/optionAShimMrtrCanonical.ts
2323
*/
2424

2525
import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server';

examples/server/src/mrtr-dual-path/shimAwaitCanonical.ts renamed to examples/server/src/mrtr-dual-path/optionBShimAwaitCanonical.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
* bucket-1" follow-up #1597's README raised. It works for idempotent
2121
* handlers. It breaks silently for everything else.
2222
*
23-
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/shimAwaitCanonical.ts
24-
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/shimAwaitCanonical.ts
23+
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/optionBShimAwaitCanonical.ts
24+
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/optionBShimAwaitCanonical.ts
2525
*/
2626

2727
import type { CallToolResult } from '@modelcontextprotocol/server';

examples/server/src/mrtr-dual-path/explicitVersionBranch.ts renamed to examples/server/src/mrtr-dual-path/optionCExplicitVersionBranch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
* This is one reading of "have clients implement both paths (i.e. not
1919
* something we hide in the SDK)" from the thread.
2020
*
21-
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/explicitVersionBranch.ts
22-
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/explicitVersionBranch.ts
21+
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/optionCExplicitVersionBranch.ts
22+
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/optionCExplicitVersionBranch.ts
2323
*/
2424

2525
import type { CallToolResult } from '@modelcontextprotocol/server';

examples/server/src/mrtr-dual-path/dualRegistration.ts renamed to examples/server/src/mrtr-dual-path/optionDDualRegistration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
* This is the other reading of "have clients implement both paths" — the
2121
* two paths are separate functions, not branches.
2222
*
23-
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/dualRegistration.ts
24-
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/dualRegistration.ts
23+
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/optionDDualRegistration.ts
24+
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/optionDDualRegistration.ts
2525
*/
2626

2727
import type { CallToolResult } from '@modelcontextprotocol/server';

examples/server/src/mrtr-dual-path/degradeOnly.ts renamed to examples/server/src/mrtr-dual-path/optionEDegradeOnly.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
* identical. The difference only shows for the minority of tools that
2121
* actually elicit.
2222
*
23-
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/degradeOnly.ts
24-
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/degradeOnly.ts
23+
* Run: DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx src/mrtr-dual-path/optionEDegradeOnly.ts
24+
* DEMO_PROTOCOL_VERSION=2026-06 pnpm tsx src/mrtr-dual-path/optionEDegradeOnly.ts
2525
*/
2626

2727
import type { CallToolResult } from '@modelcontextprotocol/server';

examples/server/src/mrtr-dual-path/shims.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const MRTR_MIN_VERSION: ProtocolVersion = '2026-06';
7575
/**
7676
* Stand-in for `ctx.protocolVersion` or similar.
7777
*
78-
* Drive with `DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx shimMrtrCanonical.ts` to simulate
78+
* Drive with `DEMO_PROTOCOL_VERSION=2025-11 pnpm tsx optionAShimMrtrCanonical.ts` to simulate
7979
* an old-client session against the same handler code.
8080
*/
8181
export function negotiatedVersion(): ProtocolVersion {

0 commit comments

Comments
 (0)