Skip to main content
Glama

Click Screen

mobile_click_on_screen_at_coordinates
Destructive

Simulate screen taps at specific coordinates for mobile automation testing and interaction. Use with element detection tools to locate precise positions.

Instructions

Click on the screen at given x,y coordinates. If clicking on an element, use the list_elements_on_screen tool to find the coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYesThe device identifier to use. Use mobile_list_available_devices to find which devices are available to you.
xYesThe x coordinate to click on the screen, in pixels
yYesThe y coordinate to click on the screen, in pixels

Implementation Reference

  • src/server.ts:263-275 (registration)
    Registers the MCP tool 'mobile_click_on_screen_at_coordinates' with Zod input schema for x and y coordinates (numbers in pixels). The handler requires a selected robot/device and delegates the tap action to the platform-specific Robot implementation, returning a confirmation message.
    tool(
    	"mobile_click_on_screen_at_coordinates",
    	"Click on the screen at given x,y coordinates. If clicking on an element, use the list_elements_on_screen tool to find the coordinates.",
    	{
    		x: z.number().describe("The x coordinate to click on the screen, in pixels"),
    		y: z.number().describe("The y coordinate to click on the screen, in pixels"),
    	},
    	async ({ x, y }) => {
    		requireRobot();
    		await robot!.tap(x, y);
    		return `Clicked on screen at coordinates: ${x}, ${y}`;
    	}
    );
  • Interface definition for the tap method in the Robot class, which all platform implementations (Android, iOS, Simulator) must provide. This is the core abstraction used by the tool handler.
     */
    tap(x: number, y: number): Promise<void>;
  • Android-specific handler implementation using ADB shell 'input tap' command with the provided x,y coordinates.
    public async tap(x: number, y: number): Promise<void> {
    	this.adb("shell", "input", "tap", `${x}`, `${y}`);
    }
  • iOS physical device handler: delegates tap to WebDriverAgent after ensuring tunnel and WDA are running.
    public async tap(x: number, y: number): Promise<void> {
    	const wda = await this.wda();
    	await wda.tap(x, y);
    }
  • Core tap implementation for iOS/Simulator via WebDriverAgent: sends pointer actions (move to x,y, down, pause 100ms, up) to WDA /actions endpoint within a session.
    public async tap(x: number, y: number) {
    	await this.withinSession(async sessionUrl => {
    		const url = `${sessionUrl}/actions`;
    		await fetch(url, {
    			method: "POST",
    			headers: {
    				"Content-Type": "application/json",
    			},
    			body: JSON.stringify({
    				actions: [
    					{
    						type: "pointer",
    						id: "finger1",
    						parameters: { pointerType: "touch" },
    						actions: [
    							{ type: "pointerMove", duration: 0, x, y },
    							{ type: "pointerDown", button: 0 },
    							{ type: "pause", duration: 100 },
    							{ type: "pointerUp", button: 0 }
    						]
    					}
    				]
    			}),
    		});
    	});
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / device
      Added value: +{
      +  "description": "The device identifier to use. Use mobile_list_available_devices to find which devices are available to you.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "x",
      -  "y"
      -]New value: +[
      +  "device",
      +  "x",
      +  "y"
      +]
  2. First observed

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The destructiveHint annotation already flags this as potentially destructive, and the description doesn't add further behavioral details beyond the click action. It provides a useful workflow hint but not additional side-effect information, which is acceptable given the simple nature of the tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two short sentences with the action first. No redundant phrases, every sentence serves a purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple, all params are documented, and the annotation covers the destructive nature. The description gives enough context for using coordinates and when to use list_elements. Minor lack of success/failure details is acceptable without an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with descriptions for x, y, and device. The description doesn't add new semantics beyond the schema, but the guidance about element coordinates complements the parameter meaning. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the action as clicking at x,y coordinates with a specific verb and resource. It differentiates from sibling tools like double_tap or long_press by focusing on a single coordinate-based click. It also mentions an alternative for element-based clicking.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly states that for clicking on an element, one should first use list_elements_on_screen to find coordinates, providing direct guidance on when to use this tool versus the alternative. It doesn't explicitly exclude other gesture tools, but the guidance is clear and actionable.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.