Skip to main content
Glama

tap_element

Taps Android UI elements by index, text, resource ID, description, or coordinates; supports long press and returns confirmation and timing.

Instructions

智能语义点击工具。支持按 #index、text、text_contains、resource_id、description 或 (x, y) 点击。 点击即返回确认与耗时,不默认回抓整棵树——观察交给 ui_snapshot 的差异模式,节奏才跟得上手。

Input Schema

NameRequiredDescriptionDefault
xNo兜底直接点击的横坐标 X
yNo兜底直接点击的纵坐标 Y
textNo精确匹配元素文本(如 '设置'、'确定')
indexNo来自 get_ui_tree 或标注截图的元素编号(如 0, 1, 2)
long_clickNo是否长按,默认 False
descriptionNo匹配元素的 content-desc 无障碍描述
resource_idNo匹配元素的 resource-id 或短 id(如 'search_box' 或 'com.xxx:id/btn')
wait_timeoutNo若按文本/ID查找,最多等待元素出现的秒数,默认 3.0 秒
text_containsNo模糊包含匹配元素文本
wait_after_msNo点击后等待界面响应的毫秒数,默认 0ms;需要等待请用条件
return_ui_afterNo点击后是否附带完整新界面 UI 树。默认 False——这次重抓是全流程里最贵的一步(全树约 200ms + 大量上下文);连续点击时保持 False,需要看变化用 ui_snapshot(since_snapshot_id=...) 只取差异

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

A4/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full burden; it discloses the return contract (confirmation + elapsed time), the default of not re-capturing the UI tree, and a concrete cost figure for the expensive path (~200ms full tree + heavy context). It still says nothing about failure behavior when no element matches or about precedence when multiple selectors are passed.

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

Conciseness4/5

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

Three short sentences, front-loaded with the selector inventory then the behavioral caveat. Slightly rhetorical phrasing ('节奏才跟得上手') is the only filler; everything else earns its place.

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

Completeness3/5

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

An output schema exists, so return values needn't be re-explained, and the description covers the cost tradeoff well. But for an 11-parameter tool with six mutually-overlapping selector inputs and zero annotations, the missing precedence rules and not-found behavior are meaningful gaps.

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%, so every one of the 11 parameters is already documented in the schema with defaults and semantics. The description's selector list mirrors the schema rather than adding syntax, precedence, or combination rules beyond it; the baseline 3 applies.

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?

States a specific verb+resource ('智能语义点击工具') and immediately enumerates the six selector strategies (#index / text / text_contains / resource_id / description / (x,y)), which lets an agent distinguish it from generic siblings like act or perform_gesture without opening the schema.

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?

Explicitly routes post-click observation to ui_snapshot's diff mode ('观察交给 ui_snapshot 的差异模式') and reinforces the when-not condition for return_ui_after. It does not, however, disambiguate against sibling action tools such as element_action, act, or batch_ui_actions, which an agent would have to infer.

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