Skip to main content
Glama

click_element

Tap Android UI elements by matching selectors like text, resource ID, or class name for reliable automation without using raw coordinates.

Instructions

Find a UI element matching the selector and tap its center. This is the preferred way to interact with UI elements rather than using raw coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesElement selector to find and click
device_idNoDevice serial number

Implementation Reference

  • The implementation of the click_element tool logic, which finds an element by selector, taps its center, and invalidates the UI cache.
    export async function clickElement(
      selector: ElementSelector,
      deviceId?: string
    ): Promise<FoundElement> {
      const resolved = await deviceManager.resolveDeviceId(deviceId);
      const element = await findElement(selector, resolved);
    
      await tap(element.bounds.centerX, element.bounds.centerY, resolved);
    
      // Invalidate UI tree cache since we mutated the screen
      invalidateUITreeCache(resolved);
    
      log.info('Element clicked', {
        selector,
        center: { x: element.bounds.centerX, y: element.bounds.centerY },
        deviceId: resolved,
      });
    
      return element;
    }
Behavior2/5

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

No annotations are provided, so the description carries full disclosure burden. While it specifies 'tap its center' (behavioral detail), it lacks critical information: failure behavior if element not found, handling of multiple matches, timeout/wait behavior, side effects, or whether the action is destructive. For a state-modifying UI tool, this is insufficient behavioral transparency.

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?

Exactly two sentences with zero waste. The first sentence front-loads the core action; the second provides comparative context. Every word earns its place in guiding tool selection.

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

Completeness2/5

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

Given the tool's complexity (9 nested selector criteria, state-changing action, no output schema, no annotations), the description is incomplete. It omits error handling, return values, visibility requirements, and multi-match resolution strategy—all critical for a UI automation tool with rich selection logic.

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 description coverage is 100%, establishing a baseline of 3. The description references 'selector' generically but does not add semantic context about selector syntax, precedence of matching criteria, or practical examples beyond what the schema's property descriptions already provide.

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 states the tool 'Find a UI element matching the selector and tap its center,' providing specific verb (find/tap), resource (UI element), and scope. It explicitly distinguishes from sibling tool `tap` by noting this is preferred 'rather than using raw coordinates.'

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?

Provides explicit guidance by stating this is the 'preferred way to interact with UI elements rather than using raw coordinates,' establishing when to use this over coordinate-based alternatives. However, it does not address when to use this versus siblings like `smart_click`, `double_tap`, or `long_press`.

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

Install Server

Other Tools

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/divineDev-dotcom/android_mcp'

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