Deprecate roots, sampling, and logging methods per SEP-2577 (#2926)
This commit is contained in:
parent
5734acf18e
commit
4573e4ac33
1 changed files with 206 additions and 123 deletions
|
|
@ -143,13 +143,13 @@ def test_multiple_content_types() -> list[TextContent | ImageContent | EmbeddedR
|
|||
@mcp.tool()
|
||||
async def test_tool_with_logging(ctx: Context) -> str:
|
||||
"""Tests tool that emits log messages during execution"""
|
||||
await ctx.info("Tool execution started")
|
||||
await ctx.info("Tool execution started") # pyright: ignore[reportDeprecated]
|
||||
await asyncio.sleep(0.05)
|
||||
|
||||
await ctx.info("Tool processing data")
|
||||
await ctx.info("Tool processing data") # pyright: ignore[reportDeprecated]
|
||||
await asyncio.sleep(0.05)
|
||||
|
||||
await ctx.info("Tool execution completed")
|
||||
await ctx.info("Tool execution completed") # pyright: ignore[reportDeprecated]
|
||||
return "Tool with logging executed successfully"
|
||||
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ async def test_sampling(prompt: str, ctx: Context) -> str:
|
|||
"""Tests server-initiated sampling (LLM completion request)"""
|
||||
try:
|
||||
# Request sampling from client
|
||||
result = await ctx.session.create_message(
|
||||
result = await ctx.session.create_message( # pyright: ignore[reportDeprecated]
|
||||
messages=[SamplingMessage(role="user", content=TextContent(type="text", text=prompt))],
|
||||
max_tokens=100,
|
||||
)
|
||||
|
|
@ -314,13 +314,13 @@ def test_error_handling() -> str:
|
|||
@mcp.tool()
|
||||
async def test_reconnection(ctx: Context) -> str:
|
||||
"""Tests SSE polling by closing stream mid-call (SEP-1699)"""
|
||||
await ctx.info("Before disconnect")
|
||||
await ctx.info("Before disconnect") # pyright: ignore[reportDeprecated]
|
||||
|
||||
await ctx.close_sse_stream()
|
||||
|
||||
await asyncio.sleep(0.2) # Wait for client to reconnect
|
||||
|
||||
await ctx.info("After reconnect")
|
||||
await ctx.info("After reconnect") # pyright: ignore[reportDeprecated]
|
||||
return "Reconnection test completed"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue