|
22 | 22 | http-standard-headers - Connect, call a tool (Mcp-* headers checked) |
23 | 23 | http-invalid-tool-headers - List tools, call every surfaced tool (x-mcp-header filter) |
24 | 24 | elicitation-sep1034-client-defaults - Elicitation with default accept callback |
25 | | - sep-2322-client-request-state - Drive the manual MRTR retry surface |
| 25 | + sep-2322-client-request-state - Drive the MRTR auto-loop (SEP-2322) |
26 | 26 | auth/client-credentials-jwt - Client credentials with private_key_jwt |
27 | 27 | auth/client-credentials-basic - Client credentials with client_secret_basic |
28 | 28 | auth/* - Authorization code flow (default for auth scenarios) |
@@ -374,46 +374,28 @@ async def run_elicitation_defaults(server_url: str) -> None: |
374 | 374 |
|
375 | 375 | @register("sep-2322-client-request-state") |
376 | 376 | async def run_mrtr_client(server_url: str) -> None: |
377 | | - """Drive the manual MRTR retry surface against the SEP-2322 client mock. |
378 | | -
|
379 | | - The mock speaks the modern lifecycle (server/discover, no initialize) and |
380 | | - inspects the wire params of each tools/call round, so this exercises the |
381 | | - explicit allow_input_required=True path rather than an auto-loop: round 1 |
382 | | - receives an InputRequiredResult, the fixture fulfils the elicitation |
383 | | - locally, then round 2 retries with input_responses + the echoed |
384 | | - request_state. Passing request_state straight off the typed result -- a |
385 | | - str when the server sent one, None when it didn't -- lets the |
386 | | - serializer's exclude_none drop the key in the no-state case without a |
387 | | - branch here. The unrelated call between rounds proves MRTR params don't |
388 | | - leak across tools, and the no-result-type call must parse as a complete |
389 | | - CallToolResult with no retry. |
| 377 | + """Drive the SEP-2322 client mock through `Client.call_tool`'s auto-loop. |
| 378 | +
|
| 379 | + The mock inspects raw `tools/call` params, so registering an |
| 380 | + `elicitation_callback` and letting the driver run is enough to satisfy |
| 381 | + all five wire-shape checks: the driver echoes `request_state` byte-exact |
| 382 | + and omits it when the server sent none, every retry mints a fresh |
| 383 | + JSON-RPC id, the unrelated call between auto-loops carries no MRTR |
| 384 | + params, and the no-`resultType` response parses as a terminal |
| 385 | + `CallToolResult` so the driver never retries it. |
390 | 386 | """ |
391 | | - async with Client(server_url, mode=client_mode()) as client: |
392 | | - await client.list_tools() |
393 | | - confirm = {"confirm": types.ElicitResult(action="accept", content={"confirmed": True})} |
394 | 387 |
|
395 | | - r1 = await client.call_tool("test_mrtr_echo_state", {}, allow_input_required=True) |
396 | | - assert isinstance(r1, types.InputRequiredResult) |
397 | | - |
398 | | - await client.call_tool("test_mrtr_unrelated", {}) |
| 388 | + async def confirm( |
| 389 | + context: ClientRequestContext, params: types.ElicitRequestParams |
| 390 | + ) -> types.ElicitResult | types.ErrorData: |
| 391 | + return types.ElicitResult(action="accept", content={"confirmed": True}) |
399 | 392 |
|
400 | | - await client.call_tool( |
401 | | - "test_mrtr_echo_state", |
402 | | - {}, |
403 | | - input_responses=confirm, |
404 | | - request_state=r1.request_state, |
405 | | - allow_input_required=True, |
406 | | - ) |
| 393 | + async with Client(server_url, mode=client_mode(), elicitation_callback=confirm) as client: |
| 394 | + await client.list_tools() |
407 | 395 |
|
408 | | - r2 = await client.call_tool("test_mrtr_no_state", {}, allow_input_required=True) |
409 | | - assert isinstance(r2, types.InputRequiredResult) |
410 | | - await client.call_tool( |
411 | | - "test_mrtr_no_state", |
412 | | - {}, |
413 | | - input_responses=confirm, |
414 | | - request_state=r2.request_state, |
415 | | - allow_input_required=True, |
416 | | - ) |
| 396 | + await client.call_tool("test_mrtr_echo_state", {}) |
| 397 | + await client.call_tool("test_mrtr_unrelated", {}) |
| 398 | + await client.call_tool("test_mrtr_no_state", {}) |
417 | 399 |
|
418 | 400 | result = await client.call_tool("test_mrtr_no_result_type", {}) |
419 | 401 | assert isinstance(result, types.CallToolResult) |
|
0 commit comments