input_tap
Simulate screen taps at precise coordinates on Android devices for automated testing and UI interaction.
Instructions
Tap at specific coordinates
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X coordinate for tap | |
| y | Yes | Y coordinate for tap |
Implementation Reference
- src/tools/handlers.ts:168-184 (handler)The handler function that implements the input_tap tool logic: taps at (x,y) coordinates using ADB command and appends updated UI hierarchy dump.input_tap: async (args: any) => { const { x, y } = args as { x: number; y: number }; await executeCommand(`adb shell input tap ${x} ${y}`); const uiContent = await captureUIContent(false); return { content: [ { type: 'text', text: `Tap executed at coordinates: (${x}, ${y})`, }, ...uiContent, ], }; },
- src/tools/definitions.ts:86-102 (schema)Input schema and metadata definition for the input_tap tool.name: 'input_tap', description: 'Tap at specific coordinates', inputSchema: { type: 'object', properties: { x: { type: 'number', description: 'X coordinate for tap', }, y: { type: 'number', description: 'Y coordinate for tap', }, }, required: ['x', 'y'], }, },
- src/index.ts:26-30 (registration)Registration of the list tools handler, which exposes the input_tap tool via the toolDefinitions array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions, }; });
- src/index.ts:32-46 (registration)Registration of the call tool handler, which dynamically invokes the input_tap handler from toolHandlers object based on tool name.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const handler = toolHandlers[name as keyof typeof toolHandlers]; if (!handler) { throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); } return await handler(args); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${errorMessage}`); } });