Skip to main content

app_drag

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Drag and drop: press something, hold until it is picked up, carry it, and release. Not app_swipe with different names — a swipe has no hold at either end, so it flings the list instead of moving the item in it. Give from and to as refs or locators, both resolved from one snapshot before anything is touched, or all four of x1, y1, x2, y2. It reports that the gesture was delivered and where it went; whether the drop was accepted is the app's own state, so call app_map again to see it. Discards the refs from the last app_map.

Changes the device, the app or the session: readOnlyHint is false.

Arguments​

NameTypeRequiredWhat it is
devicestringDevice serial to target, e.g. "emulator-5554". Omit when only one device is running.
driverstring: uiautomator2, uiautomator, wdaDriver 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).
duration_msintegerHow long the travel takes, in milliseconds. Defaults to 800.
fromstringA ref or locator for the thing being dragged.
hold_msintegerHow long to hold at each end, in milliseconds. Defaults to 700, above Android's 500ms long-press timeout because that is what a drag-to-reorder list arms on. Raise it first when a drag picks nothing up.
tostringA ref or locator for where it is going. Given together with from.
x1integerStart X in device pixels. Use all four, instead of from/to.
x2integerEnd X in device pixels.
y1integerStart Y in device pixels.
y2integerEnd Y in device pixels.

Examples​

Each is the arguments of a tools/call request; the first is shown whole.

Drag one element onto another​

{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "app_drag",
"arguments": {
"from": "@e3",
"to": "@e7"
}
}
}

On a device​

BeforeAfter
Before: mobium drag 'label=Drag source' 'label=Drop zone' on an Android 15 emulatorAfter: mobium drag 'label=Drag source' 'label=Drop zone' on an Android 15 emulator

mobium drag 'label=Drag source' 'label=Drop zone' on an Android 15 emulator