long_press
Simulate long press gestures on Android devices by specifying screen coordinates and duration for UI testing and interaction automation.
Instructions
Long press at coordinates for specified duration
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes | ||
| duration_ms | No | ||
| device_serial | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/adb_mcp_server/server.py:426-432 (handler)The handler function for the 'long_press' tool. It simulates a long press by performing an ADB swipe gesture from (x,y) to (x,y) for the specified duration_ms milliseconds. The @mcp.tool() decorator registers this function as an MCP tool.
@mcp.tool() def long_press(x: int, y: int, duration_ms: int = 1000, device_serial: str | None = None) -> str: """Long press at coordinates for specified duration""" return run_adb([ "shell", "input", "swipe", str(x), str(y), str(x), str(y), str(duration_ms) ], device_serial)