app_hit_test
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Ask the platform's own hit test, below accessibility, whether a touch at the point app_tap would use reaches the target — and if not, what it would reach. The accessibility tree, and XCTest's hittable, leave out a view hidden from accessibility, so a tap under such an overlay lands on it while every check passes; UIKit's hitTest:withEvent: does not. Fails, as app_tap does, when the touch would go elsewhere, naming the receiver and whether accessibility can see it. iOS only, and opt-in: it attaches lldb to the app, which stops it for about two seconds on a simulator, where a small probe built from source is loaded on first use, and about nine on a real iPhone, where the probe is evaluated as an expression and the app must be built for development (get-task-allow), as one installed from Xcode is. Android needs none — its tree lists what accessibility hides.
Read-only: readOnlyHint is true.
Arguments
| Name | Type | Required | What it is |
|---|---|---|---|
device | string | Device serial to target, e.g. "emulator-5554". Omit when only one device is running. | |
driver | string: uiautomator2, uiautomator, wda | Driver to use: "uiautomator2" (default for Android; fast, installs a server APK on first use), "uiautomator" (Android, installs nothing, slower, cannot type), or "wda" (WebDriverAgent: iOS simulators and iPhones). | |
target | string | yes | A ref from app_map ("@e5") or a locator ("testid=submit") |
Examples
Each is the arguments of a tools/call request; the first is shown whole.
Ask where a tap on an element would really land
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "app_hit_test",
"arguments": {
"target": "testid=submit"
}
}
}