scroll_down
Scroll down on the current Android device screen using ADB commands. This tool helps navigate content during Flutter development, UI testing, or visual QA workflows.
Instructions
Scroll down on the current screen
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:462-470 (handler)The main handler function for the 'scroll_down' tool. It calculates screen dimensions using get_screen_specs, determines swipe coordinates (center horizontally, from 70% down to 30% vertically), and performs a swipe gesture using the swipe helper function. The @mcp.tool() decorator registers this function as an MCP tool named 'scroll_down'.@mcp.tool() def scroll_down(device_serial: str | None = None) -> str: """Scroll down on the current screen""" specs = get_screen_specs(device_serial) center_x = specs['width_px'] // 2 start_y = int(specs['height_px'] * 0.7) end_y = int(specs['height_px'] * 0.3) return swipe(center_x, start_y, center_x, end_y, 300, device_serial)
- src/adb_mcp_server/server.py:462-462 (registration)The @mcp.tool() decorator registers the scroll_down function as an MCP tool.@mcp.tool()
- src/adb_mcp_server/server.py:445-460 (helper)The swipe function used by scroll_down to perform the actual gesture.def swipe( start_x: int, start_y: int, end_x: int, end_y: int, duration_ms: int = 300, device_serial: str | None = None ) -> str: """Swipe from start to end coordinates""" return run_adb([ "shell", "input", "swipe", str(start_x), str(start_y), str(end_x), str(end_y), str(duration_ms) ], device_serial)
- src/adb_mcp_server/server.py:100-135 (helper)The get_screen_specs function called by scroll_down to obtain screen dimensions for calculating swipe coordinates.@mcp.tool() def get_screen_specs(device_serial: str | None = None) -> dict: """Get detailed screen specifications - useful for responsive design""" size_output = run_adb(["shell", "wm", "size"], device_serial) density_output = run_adb(["shell", "wm", "density"], device_serial) # Parse physical size size_match = re.search(r'Physical size: (\d+)x(\d+)', size_output) override_match = re.search(r'Override size: (\d+)x(\d+)', size_output) width, height = 0, 0 if override_match: width, height = int(override_match.group(1)), int(override_match.group(2)) elif size_match: width, height = int(size_match.group(1)), int(size_match.group(2)) # Parse density density = 0 density_match = re.search(r'Physical density: (\d+)', density_output) if density_match: density = int(density_match.group(1)) # Calculate useful metrics dp_width = (width / density) * 160 if density else 0 dp_height = (height / density) * 160 if density else 0 return { "width_px": width, "height_px": height, "density_dpi": density, "width_dp": round(dp_width, 1), "height_dp": round(dp_height, 1), "aspect_ratio": f"{width}:{height}", "density_bucket": get_density_bucket(density) }