Embed code snippets for README from executable examples (#1055)

This commit is contained in:
Inna Harper 2025-07-04 17:25:54 +01:00 • committed by GitHub
commit adf327164a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -146,7 +146,7 @@ class TestServer:
mcp = FastMCP()
@mcp.tool()
def add(x: int, y: int) -> int:
def sum(x: int, y: int) -> int:
return x + y
assert len(mcp._tool_manager.list_tools()) == 1
@ -158,7 +158,7 @@ class TestServer:
with pytest.raises(TypeError, match="The @tool decorator was used incorrectly"):
@mcp.tool # Missing parentheses #type: ignore
def add(x: int, y: int) -> int:
def sum(x: int, y: int) -> int:
return x + y
@pytest.mark.anyio