Skip to main content
Glama

ACTION_FIND_ELEMENT

Poll for an Android UI element by text, ID, class, or content description until timeout; return found status, bounds, text, and clickability for workflow decisions.

Instructions

找元素:限时轮询查找界面元素,输出是否找到、边界和文字(需无障碍)。输出:element_found, element_error, element_bounds, element_text, element_clickable。element_bounds 是 "left,top,right,bottom" 四个数,不能直接当 ACTION_CLICK 的 target(会点到左上角)。。字符串参数支持 ${var} 插值;结果以变量快照 JSON 返回。

Input Schema

NameRequiredDescriptionDefault
regionNo限定元素中心所在区域:top/bottom/left/right/center 或归一化 "x1,y1,x2,y2";解析不了直接失败并写 element_error
requireNo执行后要求为 true 的变量名(如 click_success),不满足按出错处理
on_errorNo节点出错时:skip=跳过继续(默认),stop=停止整个工作流
selectorYes要找的文字 / 完整 viewId / 类名 / 内容描述(按 search_mode)。支持 ${var}
output_varNo可选:把元素详情 map(found/bounds/text/clickable/contentDescription/className/packageName)存到这个变量
timeout_msNo最长查找毫秒(每 100ms 重试一次)(默认 3000)
search_modeNotext=界面文字(不区分大小写的子串)、id=完整 viewId、class=类名子串、content_desc=内容描述子串;主方式找不到会自动换其它方式再找(默认 text)
node_timeout_msNo单节点超时毫秒,0=不限;默认 30 分钟

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses time-limited polling, the accessibility-service requirement ('需无障碍'), that results come back as a variable-snapshot JSON, and the exact output field names. It omits failure/retry semantics, but those are largely covered by the require/on_error schema fields.

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

Conciseness3/5

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

Front-loaded with the core verb and the output list, which is good, but the sentence order is somewhat scattered and a duplicated '。。' punctuation error slightly hurts readability. Nothing is grossly verbose, but the structure could be tighter.

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?

There is no output schema, and the description compensates by enumerating all five returned fields and explaining the bounds format. Combined with the accessibility prerequisite and variable-snapshot return note, an agent has nearly everything needed to call and interpret this tool; only sibling differentiation and failure behavior are thin.

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%, so the schema already documents selector, search_mode, region, timeout and the rest in detail. The description adds only the general '${var} interpolation for string parameters' rule, which is marginal value on top of the schema's own per-parameter notes.

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

Purpose4/5

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

States a specific verb and resource: '限时轮询查找界面元素' with polling semantics and outputs. It does not, however, distinguish itself from the very similar sibling ACTION_WAIT_FOR_ELEMENT, leaving the agent to guess which finder to pick.

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

Usage Guidelines3/5

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

Provides one concrete usage caveat (element_bounds cannot be passed directly as ACTION_CLICK's target, or you hit the top-left corner), which is genuinely useful. But it gives no guidance on when to use this over ACTION_WAIT_FOR_ELEMENT, ACTION_READ_SCREEN, or ACTION_CLICK, so alternatives are only implied.

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