mobile_swipe
Execute swipe gestures on Android screens by specifying start and end coordinates to navigate interfaces, scroll content, or trigger actions through automated touch interactions.
Instructions
Perform a swipe gesture on the Android screen.
Args: start_x: Starting X coordinate start_y: Starting Y coordinate end_x: Ending X coordinate end_y: Ending Y coordinate duration: Duration of swipe in seconds (default: 0.5)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start_x | Yes | ||
| start_y | Yes | ||
| end_x | Yes | ||
| end_y | Yes | ||
| duration | No |
Implementation Reference
- main.py:188-207 (handler)Handler function for the 'mobile_swipe' tool, including decorator for registration. Executes swipe gesture on Android device using shell command.@mcp.tool() def mobile_swipe(start_x: int, start_y: int, end_x: int, end_y: int, duration: float = 0.5) -> str: """Perform a swipe gesture on the Android screen. Args: start_x: Starting X coordinate start_y: Starting Y coordinate end_x: Ending X coordinate end_y: Ending Y coordinate duration: Duration of swipe in seconds (default: 0.5) """ if device is None: return "Error: Device not initialized. Please call mobile_init() first to establish connection with Android device." try: duration_ms = int(duration * 1000) cmd = f"input swipe {start_x} {start_y} {end_x} {end_y} {duration_ms}" device.shell(cmd) return f"Successfully swiped from ({start_x}, {start_y}) to ({end_x}, {end_y}) in {duration}s" except Exception as e: return f"Error swiping: {str(e)}"