Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

fix: eliminate pytest warnings (#1559)

Jeremiah Lowina302385361fb
diff --git a/src/fastmcp/tools/tool_transform.py b/src/fastmcp/tools/tool_transform.py
index d492432ad..063c32361 100644
--- a/src/fastmcp/tools/tool_transform.py
+++ b/src/fastmcp/tools/tool_transform.py
@@ -439,7 +439,7 @@ class TransformedTool(Tool):
})
# Disable structured outputs
- Tool.from_tool(parent, output_schema=False)
+ Tool.from_tool(parent, output_schema=None)
# Return ToolResult for full control
async def custom_output(**kwargs) -> ToolResult:
diff --git a/tests/server/test_server_interactions.py b/tests/server/test_server_interactions.py
index 6e02ce610..370210d61 100644
--- a/tests/server/test_server_interactions.py
+++ b/tests/server/test_server_interactions.py
@@ -981,13 +981,13 @@ class TestToolOutputSchema:
assert result.structured_content == {"message": "Hello, world!"}
assert result.data == {"message": "Hello, world!"}
- async def test_output_schema_false_full_handshake(self):
- """Test that output_schema=False works through full client/server
+ async def test_output_schema_none_full_handshake(self):
+ """Test that output_schema=None works through full client/server
handshake. We test this by returning a scalar, which requires an output
schema to serialize."""
mcp = FastMCP()
- @mcp.tool(output_schema=False) # type: ignore[arg-type]
+ @mcp.tool(output_schema=None)
def simple_tool() -> int:
return 42
diff --git a/tests/tools/test_tool_manager.py b/tests/tools/test_tool_manager.py
index 0707cf7f3..3d74e82ae 100644
--- a/tests/tools/test_tool_manager.py
+++ b/tests/tools/test_tool_manager.py
@@ -1033,5 +1033,7 @@ class TestMountedComponentsRaiseOnLoadError:
# Use temporary settings context manager
with temporary_settings(mounted_components_raise_on_load_error=True):
# Should raise the exception
- with pytest.raises(AttributeError, match=""):
+ with pytest.raises(
+ AttributeError, match="'str' object has no attribute 'server'"
+ ):
await parent_mcp._tool_manager.list_tools()