Skip to content

Commit 9e9282a

Browse files
committed
Pin elicitation resolver tests to legacy mode for 2026-07-28 default
After merging main, LATEST_PROTOCOL_VERSION is 2026-07-28, which defines no server-to-client requests, so elicitation/create is unavailable at the default negotiated version. Pin these tests to mode='legacy' (negotiates 2025-11-25) where elicitation is supported, matching test_elicitation.py.
1 parent 3f59ea3 commit 9e9282a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

tests/server/mcpserver/test_resolve.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async def whoami(login: Annotated[Login, Resolve(login)]) -> str:
6565
async def never(context: ClientRequestContext, params: ElicitRequestParams) -> ElicitResult: # pragma: no cover
6666
raise AssertionError("should not elicit")
6767

68-
async with Client(mcp, elicitation_callback=never) as client:
68+
async with Client(mcp, mode="legacy", elicitation_callback=never) as client:
6969
assert await _text(client, "whoami", {}) == "from-resolver"
7070

7171

@@ -80,7 +80,7 @@ async def login(ctx: Context) -> Login | Elicit[Login]:
8080
async def whoami(login: Annotated[Login, Resolve(login)]) -> str:
8181
return login.username
8282

83-
async with Client(mcp, elicitation_callback=_accept({"username": "octocat"})) as client:
83+
async with Client(mcp, mode="legacy", elicitation_callback=_accept({"username": "octocat"})) as client:
8484
assert await _text(client, "whoami", {}) == "octocat"
8585

8686

@@ -101,7 +101,7 @@ async def whoami(
101101
case _: # pragma: no cover - accepted in this test
102102
return "no username"
103103

104-
async with Client(mcp, elicitation_callback=_accept({"username": "octocat"})) as client:
104+
async with Client(mcp, mode="legacy", elicitation_callback=_accept({"username": "octocat"})) as client:
105105
assert await _text(client, "whoami", {}) == "hi octocat"
106106

107107

@@ -120,7 +120,7 @@ async def whoami(
120120
return "declined gracefully"
121121
raise NotImplementedError
122122

123-
async with Client(mcp, elicitation_callback=_decline) as client:
123+
async with Client(mcp, mode="legacy", elicitation_callback=_decline) as client:
124124
assert await _text(client, "whoami", {}) == "declined gracefully"
125125

126126

@@ -135,7 +135,7 @@ async def login(ctx: Context) -> Login | Elicit[Login]:
135135
async def whoami(login: Annotated[Login, Resolve(login)]) -> str:
136136
raise NotImplementedError # pragma: no cover - never reached
137137

138-
async with Client(mcp, elicitation_callback=_decline) as client:
138+
async with Client(mcp, mode="legacy", elicitation_callback=_decline) as client:
139139
result = await client.call_tool("whoami", {})
140140
assert result.is_error
141141
assert isinstance(result.content[0], TextContent)
@@ -168,7 +168,7 @@ async def callback(context: ClientRequestContext, params: ElicitRequestParams) -
168168
assert "Star modelcontextprotocol/python-sdk as octocat?" in params.message
169169
return ElicitResult(action="accept", content={"ok": True})
170170

171-
async with Client(mcp, elicitation_callback=callback) as client:
171+
async with Client(mcp, mode="legacy", elicitation_callback=callback) as client:
172172
text = await _text(client, "star_repo", {"repo": "modelcontextprotocol/python-sdk"})
173173
assert text == "starred modelcontextprotocol/python-sdk as octocat"
174174

@@ -198,7 +198,7 @@ async def callback(context: ClientRequestContext, params: ElicitRequestParams) -
198198
return ElicitResult(action="accept", content={"username": "octocat"})
199199
return ElicitResult(action="accept", content={"ok": True})
200200

201-
async with Client(mcp, elicitation_callback=callback) as client:
201+
async with Client(mcp, mode="legacy", elicitation_callback=callback) as client:
202202
assert await _text(client, "star_repo", {}) == "octocat:True"
203203
assert elicit_count == 1
204204

@@ -217,7 +217,7 @@ async def whoami(login: Annotated[Login, Resolve(login)]) -> str:
217217
async def never(context: ClientRequestContext, params: ElicitRequestParams) -> ElicitResult: # pragma: no cover
218218
raise AssertionError("should not elicit")
219219

220-
async with Client(mcp, elicitation_callback=never) as client:
220+
async with Client(mcp, mode="legacy", elicitation_callback=never) as client:
221221
assert await _text(client, "whoami", {}) == "sync-user"
222222

223223

0 commit comments

Comments
 (0)