Skip to main content
Glama

Find and tap element

adb_find_and_tap

Find an on-screen element by text, resource-id or content-desc and activate it over ADB, tapping touchscreens or walking DPAD focus on leanback devices.

Instructions

Find an on-screen element by text, resource-id or content-desc and activate it. The method is derived from the device: with a touchscreen the element centre is tapped; on leanback without one the focus is walked there with DPAD keys, since a coordinate tap activates whatever has focus. If the focus stalls, cycles, or the target is not reached in max_steps or the time budget, nothing is pressed and the tool reports where it stopped. Prefer it over adb_ui_dump plus adb_tap when the label is known; use adb_tap for a point that has no label.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descNocontent-desc to match
textNoVisible label to match, checked against both the text attribute and content-desc (substring by default, case-insensitive). Some TV launchers put every label in content-desc and leave text empty.
exactNoRequire an exact match instead of substring. Default false.
indexNoWhich match to use when several elements match. Without it, several matches are an error listing the candidates.
serialNoDevice serial from adb_devices. Optional when exactly one device is connected.
max_stepsNoMax DPAD steps on leanback devices, default 12, max 40. Each step re-dumps the UI (~1.5-2s) and the walk also stops after an internal ~25s budget, returning a report instead of timing out.
resource_idNoresource-id; the part after "/" is enough

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare non-read-only, non-idempotent, non-destructive, closed-world, and the description adds real behavioral context: the tap-vs-DPAD strategy is derived from the device, and on a stalled/cycling walk nothing is pressed and a report of where it stopped is returned rather than a timeout. It stops short of describing auth/device prerequisites, which are covered only implicitly.

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?

Four sentences, well front-loaded: purpose first, then method, then failure behavior, then alternative routing. Dense but each sentence carries information; only the device-strategy sentence overlaps somewhat with the parameter docs.

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 mutating, device-dependent tool with no output schema and zero required parameters, the description covers the calling modes, fallback behavior, and failure reporting. It leaves the shape of the returned failure report unspecified, which is a minor gap given no output schema exists to document it.

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 the schema already documents all seven parameters including matching defaults and max_steps limits. The description restates the matching keys and the DPAD/time-budget behavior but adds no syntax or format beyond the structured fields, so 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 (find and activate) plus the exact matching keys (text, resource-id, content-desc), and explicitly names the sibling combination it replaces. An agent can tell it apart from adb_tap and adb_ui_dump without reading 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 Guidelines5/5

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

Gives an explicit selection rule: prefer this over adb_ui_dump + adb_tap when the label is known, and use adb_tap for a point that has no label. Also warns about the focus-walk failure mode, so the agent knows when falling back is needed.

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