Skip to main content
Glama

ACTION_WAIT_FOR_ELEMENT

Waits for a UI element to appear or disappear by polling the active window through accessibility, returning element_found so workflows can branch on the condition.

Instructions

等元素:每 500ms 轮询,等待界面元素出现或消失(需无障碍)。输出:element_found。结果为 true 表示条件满足:wait_for=disappear 时 true 是「已消失」。只查当前活动窗口。。字符串参数支持 ${var} 插值;结果以变量快照 JSON 返回。

Input Schema

NameRequiredDescriptionDefault
modeNotext=可见文字或内容描述包含关键字(不区分大小写)、id=完整 viewId、class=类名子串(默认 text)
requireNo执行后要求为 true 的变量名(如 click_success),不满足按出错处理
on_errorNo节点出错时:skip=跳过继续(默认),stop=停止整个工作流
selectorYes关键字 / 完整 viewId(如 com.pkg:id/xxx)/ 类名(按 mode)。支持 ${var}
wait_forNo等出现还是等消失(默认 appear)
output_varNo结果变量名(默认 element_found)
timeout_msNo最长等待毫秒(默认 10000)(也认:timeout)
node_timeout_msNo单节点超时毫秒,0=不限;默认 30 分钟

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/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 substantial work: 500ms polling cadence, accessibility dependency, scope limited to the current active window, results surfaced as a variable snapshot JSON, and ${var} interpolation in string parameters. It omits the failure path (what is returned or raised when the condition is never met before timeout), which is the main remaining gap for a blocking operation.

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?

Dense but front-loaded: purpose, polling behavior, output variable and its polarity, scope, then interpolation. Every clause carries information, with only a stray duplicated period ('。。') as noise.

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?

For an 8-parameter blocking node with no output schema and no annotations, the description covers the crucial semantics: polarity of the boolean, output variable, polling, accessibility, and window scope. The main omission is timeout/error behavior, partially mitigated by the on_error and node_timeout_ms schema fields.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds genuinely non-obvious meaning: for wait_for=disappear, a true result means the element has disappeared, which inverts the naive reading of 'element_found'. It also confirms the default output variable name and interpolation support, though it does not touch mode/require/on_error beyond what the schema already documents.

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?

The description states a specific verb ('等元素'/wait for element) and the two conditions it waits on (appear/disappear), which is enough to distinguish it from ACTION_FIND_ELEMENT in practice. It does not name the sibling tool explicitly, so it stops short of full differentiation.

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?

Usage is implied rather than stated: the 500ms polling and appear/disappear framing tell an agent this is the blocking variant of an element lookup. There is no explicit 'use this instead of ACTION_FIND_ELEMENT when...' guidance, no statement of what happens on timeout, and the accessibility prerequisite is the only hard constraint mentioned.

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