Skip to main content
Glama

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

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

Implementation Reference

  • 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' }; } }
  • 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));
  • 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; }
  • Instantiation of ScreenTools class, providing AdbClient dependency for tool execution.
    this.screenTools = new ScreenTools(this.adbClient);

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