Skip to main content
Glama
mobile-next

Mobile Next MCP Server

Official
by mobile-next

mobile_long_press_on_screen_at_coordinates

Perform a long press action at specific screen coordinates on mobile devices to trigger context menus, drag-and-drop operations, or element interactions during mobile automation testing.

Instructions

Long press on the screen at given x,y coordinates. If long pressing on an element, use the list_elements_on_screen tool to find the coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYesThe device identifier to use. Use mobile_list_available_devices to find which devices are available to you.
xYesThe x coordinate to long press on the screen, in pixels
yYesThe y coordinate to long press on the screen, in pixels
durationNoDuration of the long press in milliseconds. Defaults to 500ms.

Implementation Reference

  • src/server.ts:372-386 (registration)
    Registers the MCP tool 'mobile_long_press_on_screen_at_coordinates' with Zod input schema (device, x, y) and inline handler that retrieves the Robot for the device and invokes its longPress method.
    tool(
    	"mobile_long_press_on_screen_at_coordinates",
    	"Long Press Screen",
    	"Long press on the screen at given x,y coordinates. If long pressing on an element, use the list_elements_on_screen tool to find the coordinates.",
    	{
    		device: z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."),
    		x: z.number().describe("The x coordinate to long press on the screen, in pixels"),
    		y: z.number().describe("The y coordinate to long press on the screen, in pixels"),
    	},
    	async ({ device, x, y }) => {
    		const robot = getRobotFromDevice(device);
    		await robot.longPress(x, y);
    		return `Long pressed on screen at coordinates: ${x}, ${y}`;
    	}
    );
  • AndroidRobot implementation of longPress: performs a stationary swipe (ADB input swipe) lasting 500ms at the given coordinates.
    public async longPress(x: number, y: number): Promise<void> {
    	// a long press is a swipe with no movement and a long duration
    	this.adb("shell", "input", "swipe", `${x}`, `${y}`, `${x}`, `${y}`, "500");
    }
  • IosRobot implementation of longPress: delegates to WebDriverAgent (wda) longPress method.
    public async longPress(x: number, y: number): Promise<void> {
    	const wda = await this.wda();
    	await wda.longPress(x, y);
    }
  • MobileDevice (for simulators) implementation of longPress: invokes mobilecli 'io longpress x,y' command.
    public async longPress(x: number, y: number): Promise<void> {
    	this.runCommand(["io", "longpress", `${x},${y}`]);
    }
  • Robot interface declaration for the longPress method, implemented by concrete robot classes.
    longPress(x: number, y: number): Promise<void>;

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/mobile-next/mobile-mcp'

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