1212
1313import click
1414from mcp .server import ServerRequestContext
15- from mcp .server .mcpserver import Context , MCPServer , RequestStateSecurity
15+ from mcp .server .mcpserver import Context , Elicit , ElicitationResult , MCPServer , RequestStateSecurity , Resolve
1616from mcp .server .mcpserver .exceptions import ToolError
1717from mcp .server .mcpserver .prompts .base import Prompt , UserMessage
1818from mcp .server .streamable_http import EventCallback , EventMessage , EventStore
@@ -350,6 +350,9 @@ def test_x_mcp_header(
350350 return f"region={ region } "
351351
352352
353+ # SEP-2575 server-stateless diagnostics (the conformance scenario probes these tools by name)
354+
355+
353356@mcp .tool ()
354357async def test_missing_capability (ctx : Context ) -> str :
355358 """Tests that a handler-raised MISSING_REQUIRED_CLIENT_CAPABILITY surfaces as a top-level JSON-RPC error.
@@ -370,6 +373,33 @@ async def test_missing_capability(ctx: Context) -> str:
370373 return "Client declared sampling capability; proceeding."
371374
372375
376+ def _ask_stream_probe () -> Elicit [UserResponse ]:
377+ return Elicit ("The stateless streaming probe asks for a word" , UserResponse )
378+
379+
380+ @mcp .tool ()
381+ async def test_streaming_elicitation (
382+ answer : Annotated [ElicitationResult [UserResponse ], Resolve (_ask_stream_probe )],
383+ ) -> str :
384+ """A tool that needs elicitation, asked through a resolver (SEP-2575 / SEP-2322).
385+
386+ On 2026-07-28 the question is returned as an InputRequiredResult rather than sent
387+ on the response stream; on earlier versions it is a mid-call elicitation request.
388+ """
389+ return f"elicitation { answer .action } "
390+
391+
392+ @mcp .tool ()
393+ async def test_logging_tool (ctx : Context ) -> str :
394+ """Logs once on the request-scoped channel (SEP-2575).
395+
396+ On 2026-07-28 the message is delivered only when the request's `_meta` sets
397+ `io.modelcontextprotocol/logLevel`.
398+ """
399+ await ctx .info ("test_logging_tool ran" ) # pyright: ignore[reportDeprecated]
400+ return "logged through the request-scoped, logLevel-gated channel"
401+
402+
373403# SEP-2322 InputRequiredResult fixtures (multi-round-trip / ephemeral workflow)
374404
375405NAME_SCHEMA = {"type" : "object" , "properties" : {"name" : {"type" : "string" }}, "required" : ["name" ]}
0 commit comments