ScrollToFindTool

class ScrollToFindTool(context: Context) : McpTool

scroll_to_find — repeatedly swipe in direction until match appears in the active window's UI tree or max_scrolls is exhausted. The current screen is checked first, so a match already visible on iteration 0 returns without any swipe.

direction uses reading semantics — it names where the content you want lives, not where the finger moves (the inversion is handled by swipeCoordsFor):

  • down → reveal content below the current viewport (finger swipes up)

  • up → reveal content above (finger swipes down)

  • right → reveal content to the right (finger swipes left)

  • left → reveal content to the left (finger swipes right)

match is a case-insensitive substring against text + content-description.

Params: required match; optional direction (default down), max_scrolls (clamped 1–20, default 5).

On success returns found = true, scrolls (Int iterations performed before the hit), and node (the matched node projection, shaped like NodeQuery.toMap). Error codes: accessibility_not_enabled (service not bound), invalid_selector (missing match or bad direction), gesture_failed (a swipe was cancelled), scroll_exhausted (no match after max_scrolls).

Constructors

Link copied to clipboard
constructor(context: Context)

Properties

Link copied to clipboard
open override val annotations: ToolAnnotations
Link copied to clipboard
open override val description: String
Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val parameters: List<ToolParameter>

Functions

Link copied to clipboard
open suspend override fun execute(params: Map<String, Any>): ToolResult