Add automatic MCP list change notifications and client message handling

Implements comprehensive notification system for tools, resources, and prompts with automatic client updates and flexible message handlers.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jeremiah Lowin 2025-06-24 22:33:06 -04:00
commit 38036b1f42
22 changed files with 1013 additions and 58 deletions

View file

@ -499,7 +499,7 @@ class TestCallTools:
mcp = FastMCP()
context = Context(fastmcp=mcp)
with context:
async with context:
result = await manager.call_tool(
"name_shrimp",
{
@ -639,7 +639,7 @@ class TestContextHandling:
mcp = FastMCP()
context = Context(fastmcp=mcp)
with context:
async with context:
result = await manager.call_tool("tool_with_context", {"x": 42})
assert result[0].text == "42" # type: ignore[attr-defined]
@ -657,7 +657,7 @@ class TestContextHandling:
mcp = FastMCP()
context = Context(fastmcp=mcp)
with context:
async with context:
result = await manager.call_tool("async_tool", {"x": 42})
assert result[0].text == "42" # type: ignore[attr-defined]
@ -675,7 +675,7 @@ class TestContextHandling:
mcp = FastMCP()
context = Context(fastmcp=mcp)
with context:
async with context:
result = await manager.call_tool("tool_with_context", {"x": 42})
assert result[0].text == "42" # type: ignore[attr-defined]
@ -722,7 +722,7 @@ class TestContextHandling:
mcp = FastMCP()
context = Context(fastmcp=mcp)
with context:
async with context:
with pytest.raises(
ToolError, match="Error calling tool 'tool_with_context'"
):