diff --git a/tests/conftest.py b/tests/conftest.py index 68d51b23..c759726b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -90,7 +90,11 @@ def get_date(): def assert_tools_simple_stream_content(chat_fun: ChatFun): - from mcp.types import ToolAnnotations + try: + from mcp.types import ToolAnnotations + except ImportError: + pytest.skip("mcp is not installed") + return chat = chat_fun(system_prompt="Be very terse, not even punctuation.") diff --git a/tests/test_tool_from_mcp.py b/tests/test_tool_from_mcp.py index e6fc2936..f620a83d 100644 --- a/tests/test_tool_from_mcp.py +++ b/tests/test_tool_from_mcp.py @@ -448,7 +448,11 @@ def test_mcp_tool_input_schema_conversion(self): def test_from_mcp_with_annotations(self): """Test creating a Tool from MCP tool with annotations.""" - from mcp.types import ToolAnnotations + try: + from mcp.types import ToolAnnotations + except ImportError: + pytest.skip("mcp is not installed") + return mcp_tool = self.create_mock_mcp_tool( name="dangerous_tool",