from __future__ import annotations from api.mcp import tool_handlers from core.device_manager import DeviceManager from tests.fakes import FakeDriver def test_mcp_handlers_are_semantic_and_hide_driver_terms() -> None: manager = DeviceManager() manager.register_device("iphone-1", lambda: FakeDriver()) manager.connect("iphone-1", max_retries=1) handlers = tool_handlers(manager=manager) responses = [ handlers["take_screenshot"](device_id="iphone-1"), handlers["tap"](x=1, y=2, device_id="iphone-1"), handlers["swipe"]( start_x=1, start_y=2, end_x=3, end_y=4, device_id="iphone-1", ), handlers["input_text"](text="hello", device_id="iphone-1"), handlers["launch_app"](app_id="com.example.app", device_id="iphone-1"), handlers["find_text"](query="Search", device_id="iphone-1"), handlers["find_icon"](name="Settings", device_id="iphone-1"), handlers["get_ui_tree"](device_id="iphone-1"), handlers["describe_screen"](device_id="iphone-1"), handlers["list_devices"](), handlers["device_status"](device_id="iphone-1"), ] serialized = repr(responses) assert "WDA" not in serialized assert "Appium" not in serialized assert "XCUI" not in serialized assert all(response is not None for response in responses)