MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_call_tool_exception

Function test_call_tool_exception

tests/tools/test_dynamic_tools.py:480–494  ·  view source on GitHub ↗

Test call_tool handles exceptions.

()

Source from the content-addressed store, hash-verified

478
479@pytest.mark.asyncio
480async def test_call_tool_exception():
481 """Test call_tool handles exceptions."""
482 tools = [
483 ToolInfo(name="test", namespace="test", description="Test tool", parameters={}),
484 ]
485 tool_manager = DummyToolManager(tools)
486 tool_manager.execute_tool = AsyncMock(side_effect=RuntimeError("network error"))
487
488 provider = DynamicToolProvider(tool_manager)
489 # Must fetch schema first (enforced workflow)
490 await provider.get_tool_schema("test")
491 result = await provider.call_tool("test", {})
492
493 assert result["success"] is False
494 assert "network error" in result["error"]
495
496
497@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 4

ToolInfoClass · 0.90
DynamicToolProviderClass · 0.90
call_toolMethod · 0.80
DummyToolManagerClass · 0.70

Tested by

no test coverage detected