Skip to main content
Glama

ACTION_LONG_PRESS

Long-press an Android UI target by pixel coordinates, on-screen text, or viewId to trigger press-and-hold actions in HabitatEngine automation workflows.

Instructions

长按:按坐标或界面文字 / viewId 长按目标(需无障碍)。输出:long_press_success。target 含逗号一律按坐标解析,解析失败直接失败(不像 ACTION_CLICK 会退回文字匹配);不支持 region/occurrence。。字符串参数支持 ${var} 插值;结果以变量快照 JSON 返回。

Input Schema

NameRequiredDescriptionDefault
targetYes"x,y" 像素坐标;或界面文字 / 完整 viewId(如 com.pkg:id/xxx,不加 id: 前缀)。支持 ${var}
requireNo执行后要求为 true 的变量名(如 click_success),不满足按出错处理
durationNo按住时长毫秒(坐标模式和手势兜底时生效),限制 1-60000(默认 800)
on_errorNo节点出错时:skip=跳过继续(默认),stop=停止整个工作流
node_timeout_msNo单节点超时毫秒,0=不限;默认 30 分钟

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does most of it: it discloses the accessibility dependency, the strict parse-failure semantics (deliberately different from ACTION_CLICK), unsupported region/occurrence options, ${var} interpolation for string parameters, and that results are returned as a variable snapshot JSON. It omits side effects/rollback and any rate or timing caveats, which keeps it short of a 5.

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?

It is front-loaded with the verb and target modes, then the key behavioral caveat, then output and interpolation notes — a sensible ordering with no filler. It loses a point for a duplicated punctuation artifact ('。。') and a slightly run-on sentence that merges the failure-mode, unsupported-options, and interpolation topics.

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 a 5-parameter action tool with no output schema and no annotations, the description covers the critical unknowns: prerequisite (accessibility), output variable name and return shape (variable snapshot JSON), and the failure contract. Remaining gaps (interaction of duration with the text-matching path, timeout behavior interplay) are partially covered by the input 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 description coverage is 100%, so the schema already documents target, require, duration, on_error, and node_timeout_ms. The description adds genuine meaning only for target (comma implies coordinate mode, parse failure is fatal) and a general note that string params support ${var}; the other four parameters get no added semantic context beyond the schema.

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 names a specific verb+resource (长按 / long press) and states the two target resolution modes (coordinates or UI text/viewId), plus the accessibility prerequisite. It explicitly contrasts its parsing behavior with the sibling ACTION_CLICK (no fallback to text matching), so an agent can distinguish the two without opening either 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?

It gives clear operating context: requires accessibility service, and comma-containing targets are always parsed as coordinates with hard failure rather than falling back to text matching. It also rules out region/occurrence options, implicitly routing those needs elsewhere, but it never names a positive alternative tool or states explicitly when a caller should prefer ACTION_CLICK instead.

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