Skip to main content
Glama

scroll_to_text

Scroll on Android device screens to locate specific text content, supporting automated UI testing and development workflows.

Instructions

Scroll until text is found on screen

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
max_scrollsNo
device_serialNo

Implementation Reference

  • The handler function for the 'scroll_to_text' tool. It repeatedly checks the UI hierarchy for elements containing the target text using find_element_by_text, scrolls down if not found, and returns the location when found or after max_scrolls attempts.
    @mcp.tool() def scroll_to_text( text: str, max_scrolls: int = 10, device_serial: str | None = None ) -> str: """Scroll until text is found on screen""" for i in range(max_scrolls): elements = find_element_by_text(text, partial_match=True, device_serial=device_serial) if elements: return f"Found '{text}' after {i} scrolls at {elements[0].get('center', 'unknown')}" scroll_down(device_serial) time.sleep(0.5) return f"Text '{text}' not found after {max_scrolls} scrolls"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rahulkr/r_adb_mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server