adb_click
Simulate screen taps at specified coordinates on Android devices to automate interactions for testing or remote control.
Instructions
Click at specific coordinates on the device screen
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X coordinate | |
| y | Yes | Y coordinate | |
| deviceId | No | Device ID (optional) |
Implementation Reference
- src/tools/screen.ts:93-137 (handler)Executes the adb_click tool logic using ADB shell 'input tap' command with validation for coordinates and device connection.
async click(options: ClickOptions) { try { const { x, y, deviceId, duration = 100 } = options; if (x < 0 || y < 0) { return { success: false, error: 'Invalid coordinates', message: 'Coordinates must be positive numbers' }; } const connected = await this.adbClient.isDeviceConnected(deviceId); if (!connected) { return { success: false, error: 'Device not connected', message: 'Cannot perform click - device is not connected' }; } const command = `shell input tap ${x} ${y}`; const result = await this.adbClient.executeCommand(command, deviceId); if (!result.success) { return { success: false, error: result.error, message: 'Failed to perform click' }; } return { success: true, data: { x, y, deviceId: deviceId || this.adbClient.getDefaultDevice() }, message: `Clicked at coordinates (${x}, ${y})` }; } catch (error: any) { return { success: false, error: error.message, message: 'Failed to perform click' }; } } - src/index.ts:108-129 (schema)MCP tool registration including name, description, and input schema for adb_click.
{ name: 'adb_click', description: 'Click at specific coordinates on the device screen', inputSchema: { type: 'object', properties: { x: { type: 'number', description: 'X coordinate', }, y: { type: 'number', description: 'Y coordinate', }, deviceId: { type: 'string', description: 'Device ID (optional)', }, }, required: ['x', 'y'], }, }, - src/index.ts:443-444 (registration)Switch case in CallToolRequest handler that routes adb_click calls to ScreenTools.click method.
case 'adb_click': return await this.handleToolCall(this.screenTools.click(args as any)); - src/types/index.ts:15-20 (schema)TypeScript interface defining the options for the click operation, matching the tool's input schema.
export interface ClickOptions { deviceId?: string; x: number; y: number; duration?: number; } - src/index.ts:38-38 (helper)Instantiation of ScreenTools class, providing AdbClient dependency for tool execution.
this.screenTools = new ScreenTools(this.adbClient);