tap
Tap at specific screen coordinates on Android devices to automate touch interactions and perform UI testing.
Instructions
Tap at specific screen coordinates
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X coordinate | |
| y | Yes | Y coordinate | |
| device_id | No | Device ID (optional if only one device) |
Implementation Reference
- src/adb.ts:295-297 (handler)The implementation of the tap command, which executes the shell input tap command via ADB.
async tap(x: number, y: number, deviceId?: string): Promise<void> { await this.exec(["shell", "input", "tap", String(x), String(y)], deviceId); } - src/index.ts:160-172 (registration)The registration of the 'tap' MCP tool, which calls the adb.tap helper method.
server.tool( "tap", "Tap at specific screen coordinates", { x: z.number().describe("X coordinate"), y: z.number().describe("Y coordinate"), device_id: z.string().optional().describe("Device ID (optional if only one device)"), }, async ({ x, y, device_id }) => { await adb.tap(x, y, device_id); return { content: [{ type: "text", text: `Tapped at (${x}, ${y})` }] }; }, );