Skip to main content
Glama

glass_scroll_to_element

Scrolls a UI until a semantic element matching name, role, description, or value is visible on-screen, reporting match and scroll details and reversing at scroll edges.

Instructions

Scroll until a semantic element is actually on-screen; returns matched, elapsed_ms, element and scrolled details. subject_mismatch flags a different app, named by subject in the untrusted block even without an element. Sweeps the chosen/inferred direction, then reverses. No match after both ends or timeout returns matched:false; no tree errors. Batched use fails the sequence on an unmatched predicate. For 2+ known steps, use glass_do.

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": "glass_scroll_to_element"
  }
}

Input Schema

NameRequiredDescriptionDefault
xNoWindow-relative anchor x; supply both x/y for a container. Default target row/column, or window center if absent.
yNoScroll anchor y (window-relative). See `x`.
nameNoSubstring of the target element's accessible name (selector).
roleNoElement role filter, e.g. "ListItem", "Button", "Document" (selector).
stepNoWheel notches per step (default 3); large steps can skip realized rows.
directionNoup/down/left/right. Default infers off-screen direction, or down then up if absent. Reverses at the first end.
timeout_msNoTimeout in ms (default 20000). Standalone: matched:false; batched: fails the sequence.
descriptionNoAccessible-description substring; can select unnamed controls.
value_containsNoValue substring; requires name, description and/or role.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv1.8.0
    • changedInput schema / properties / description / description
      Previous value: -"Substring of the target element's accessible description (selector). This can select\nan unnamed control, including an Android text field labelled only by its hint."New value: +"Accessible-description substring; can select unnamed controls."
    • changedInput schema / properties / direction / description
      Previous value: -"Sweep direction: \"up\"/\"down\" (vertical) or \"left\"/\"right\" (horizontal).\nOmit to infer it from the target's off-screen position (falls back to a\nvertical down→up sweep when the target isn't in the a11y tree yet). The\nsearch reverses to the other end if the target isn't found first."New value: +"up/down/left/right. Default infers off-screen direction, or down then up if absent. Reverses at the first end."
    • changedInput schema / properties / step / description
      Previous value: -"Wheel notches per scroll step (default 3). A calibration escape hatch — larger\ncovers distance faster but risks stepping past a row's/column's realized band."New value: +"Wheel notches per step (default 3); large steps can skip realized rows."
    • changedInput schema / properties / timeout_ms / description
      Previous value: -"Give up after this long (default 20000ms); returns `{matched:false}`."New value: +"Timeout in ms (default 20000). Standalone: matched:false; batched: fails the sequence."
    • changedInput schema / properties / value_contains / description
      Previous value: -"Additionally require the matched element's `value` to contain this substring.\nNot a standalone selector — `name`, `description`, and/or `role` is still required."New value: +"Value substring; requires name, description and/or role."
    • changedInput schema / properties / x / description
      Previous value: -"Scroll anchor x (window-relative). By default the swipe anchors on the target's\nown row/column (falling back to the window center if it isn't in the a11y tree\nyet); set both `x` and `y` to point the wheel at a specific container instead."New value: +"Window-relative anchor x; supply both x/y for a container. Default target row/column, or window center if absent."
  2. Changed4 schema fields changedv1.5.1
    • addedInput schema / properties / description
      Added value: +{
      +  "description": "Substring of the target element's accessible description (selector). This can select\nan unnamed control, including an Android text field labelled only by its hint.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • changedInput schema / properties / name / description
      Previous value: -"Substring of the target element's accessible name (selector). `name` and/or\n`role` is required."New value: +"Substring of the target element's accessible name (selector)."
    • changedInput schema / properties / role / description
      Previous value: -"Element role filter, e.g. \"ListItem\", \"Button\" (selector)."New value: +"Element role filter, e.g. \"ListItem\", \"Button\", \"Document\" (selector)."
    • changedInput schema / properties / value_contains / description
      Previous value: -"Additionally require the matched element's `value` to contain this substring.\nNot a standalone selector — `name` and/or `role` is still required."New value: +"Additionally require the matched element's `value` to contain this substring.\nNot a standalone selector — `name`, `description`, and/or `role` is still required."
  3. Changed1 schema field changedv1.2.0
    • removedInput schema / title
      Removed value: -"ScrollToElementArgs"
  4. Addedv1.1.0
  5. Removedv1.0.3
  6. Addedv1.0.3
  7. Removedv1.0.2
  8. First observedv1.0.1

TDQS

A4.3/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=false/destructiveHint=false/openWorldHint=false, so the description carries the burden and does so: it discloses return keys (matched, elapsed_ms, element, scrolled), subject_mismatch behavior, the sweep-and-reverse search order, the no-tree-error property, and how timeout differs standalone versus batched. That is substantial behavior beyond the annotations and nothing contradicts them.

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?

Front-loaded with purpose then return values then edge cases then the routing hint, and most sentences carry distinct information. It is dense with internal jargon ('untrusted block', 'predicate') that costs a little readability but is not 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?

With 9 optional parameters and no output schema, the description fills the important gaps: it enumerates return fields, describes failure modes (both ends reached, timeout) and documents the cross-step failure behavior under batching. Remaining ambiguity is mostly what counts as a 'semantic element' match, which the selector params in the schema partly cover.

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% and already documents direction inference/reversal and the timeout standalone-vs-batched outcome, so the description's direction and timeout sentences largely restate structured data. The only added meaning is the notion of an 'untrusted block' and 'semantic element', which is marginal; baseline 3 is appropriate.

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+resource+goal: scroll until a semantic element is actually on-screen, and explicitly distinguishes itself from glass_scroll and glass_do by naming a concrete selection rule ('For 2+ known steps, use glass_do'). An agent can tell this apart from siblings without opening 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 an explicit alternative for the multi-step case and implies the single-target case where the tool applies. It does not, however, contrast itself with glass_wait_for_element or explain when to prefer a plain glass_scroll, so guidance is clear but not complete.

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