Deprecate roots, sampling, and logging methods per SEP-2577 (#2926)
This commit is contained in:
parent
5734acf18e
commit
4573e4ac33
2 changed files with 206 additions and 123 deletions
|
|
@ -41,10 +41,10 @@ async def test_context_logging_helpers_send_log_notifications(connect: Connect)
|
|||
|
||||
@mcp.tool()
|
||||
async def narrate(ctx: Context) -> str:
|
||||
await ctx.debug("d")
|
||||
await ctx.info("i")
|
||||
await ctx.warning("w")
|
||||
await ctx.error("e")
|
||||
await ctx.debug("d") # pyright: ignore[reportDeprecated]
|
||||
await ctx.info("i") # pyright: ignore[reportDeprecated]
|
||||
await ctx.warning("w") # pyright: ignore[reportDeprecated]
|
||||
await ctx.error("e") # pyright: ignore[reportDeprecated]
|
||||
return "done"
|
||||
|
||||
async def collect(params: LoggingMessageNotificationParams) -> None:
|
||||
|
|
@ -136,7 +136,7 @@ async def test_report_progress_without_a_progress_token_sends_nothing(connect: C
|
|||
@mcp.tool()
|
||||
async def mill(ctx: Context) -> str:
|
||||
await ctx.report_progress(1, 3)
|
||||
await ctx.info("milling done")
|
||||
await ctx.info("milling done") # pyright: ignore[reportDeprecated]
|
||||
return "milled"
|
||||
|
||||
async def collect(message: IncomingMessage) -> None:
|
||||
|
|
@ -250,8 +250,8 @@ async def test_set_logging_level_is_rejected_and_messages_are_never_filtered(con
|
|||
|
||||
@mcp.tool()
|
||||
async def chatter(ctx: Context) -> str:
|
||||
await ctx.debug("noise")
|
||||
await ctx.error("signal")
|
||||
await ctx.debug("noise") # pyright: ignore[reportDeprecated]
|
||||
await ctx.error("signal") # pyright: ignore[reportDeprecated]
|
||||
return "done"
|
||||
|
||||
async def collect(params: LoggingMessageNotificationParams) -> None:
|
||||
|
|
@ -259,7 +259,7 @@ async def test_set_logging_level_is_rejected_and_messages_are_never_filtered(con
|
|||
|
||||
async with connect(mcp, logging_callback=collect) as client:
|
||||
with pytest.raises(MCPError) as exc_info:
|
||||
await client.set_logging_level("error")
|
||||
await client.set_logging_level("error") # pyright: ignore[reportDeprecated]
|
||||
|
||||
await client.call_tool("chatter", {})
|
||||
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ async def test_adding_and_removing_tools_does_not_notify_connected_clients(conne
|
|||
async def grow(ctx: Context) -> str:
|
||||
mcp.add_tool(extra, name="extra")
|
||||
mcp.remove_tool("doomed")
|
||||
await ctx.info("tool set changed")
|
||||
await ctx.info("tool set changed") # pyright: ignore[reportDeprecated]
|
||||
return "mutated"
|
||||
|
||||
async def collect(message: IncomingMessage) -> None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue