Skip to main content
Glama

adb_click

Execute screen clicks at precise coordinates on Android devices using the ADB MCP Server, enabling automation and testing for remote device management and screen operations.

Instructions

Click at specific coordinates on the device screen

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdNoDevice ID (optional)
xYesX coordinate
yYesY coordinate

Implementation Reference

  • The core handler function for adb_click tool, executing ADB shell input tap command at given coordinates after validation.
    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' }; } }
  • MCP tool schema definition including input schema for parameters x, y (required), deviceId (optional).
    { 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)
    Registration of adb_click handler in the CallToolRequest switch statement, delegating to ScreenTools.click.
    case 'adb_click': return await this.handleToolCall(this.screenTools.click(args as any));
  • TypeScript interface definition for ClickOptions used in the handler.
    export interface ClickOptions { deviceId?: string; x: number; y: number; duration?: number; }

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/richard0913/adb-mcp'

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