Skip to main content
Glama

find_element

Read-only

Locate UI elements by text, resource ID, or type without interacting, returning center, size, and state details for assertions and verifications on Android and iOS devices.

Instructions

Find UI elements by text, resource_id, or type without interacting. Returns matching element details (center, size, state flags). Useful for assertions and verifications.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "find_element"
  }
}

Input Schema

NameRequiredDescriptionDefault
platformNoTarget platform. Inferred if omitted.
device_idNoDevice ID. Omit for the connected device.
text_exactNoFind element whose text matches exactly
max_resultsNoMaximum number of matching elements to return. Default: 10
max_scrollsNoMaximum number of scrolls when scroll_to_find is true. Default: 5
resource_idNoFind element whose resource_id contains this substring (case-insensitive)
text_containsNoFind element whose text contains this substring (case-insensitive)
type_containsNoFilter by element type containing this substring (case-insensitive)
scroll_to_findNoIf true, scroll iteratively to find the element. Default: false
scroll_directionNoDirection to scroll the content when scroll_to_find is true. Default: down

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.1

TDQS

A4.2/5.0
Behavior4/5

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

readOnlyHint=true already declares the safety profile, so the bar is lower, and the description still adds value by naming the return payload (center, size, state flags) that no output schema documents. It does not say what happens on zero matches (empty list vs. error), which is the one behavioral gap an assertion-oriented caller would want.

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

Conciseness5/5

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

Three short sentences, front-loaded with the verb and filters, then the return shape, then the use case. Nothing is redundant with the title and no sentence is filler.

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 ten-parameter, zero-required, read-only lookup with no output schema, the description covers purpose, payload shape, and safe non-interaction. The remaining gap is result semantics when nothing matches, which matters for a tool pitched at assertions.

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 explains all ten parameters in detail. The description echoes the three headline filters (text, resource_id, type) but adds no matching semantics, defaults, or scroll_to_find/max_scrolls interaction beyond what the schema states — baseline 3 is correct.

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 and resource (find UI elements) plus the filter dimensions (text, resource_id, type) and the key scope constraint 'without interacting'. That last phrase is what separates it from tap_element/double_tap/long_press without the agent needing to open any 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?

Gives a clear use context ('useful for assertions and verifications'), which tells the agent this is a non-mutating inspection call rather than an action. It stops short of exclusions — it never says to prefer wait_for_element when the element may not yet exist, or get_ui_tree when a full dump is needed.

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