Skip to main content
Glama

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
NameRequiredDescriptionDefault
start_xYes
start_yYes
end_xYes
end_yYes
durationNo

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)}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/erichung9060/Android-Mobile-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server