mouse_scroll
Scroll the mouse wheel up or down with adjustable steps and optional coordinate targeting for desktop automation in Hyprland.
Instructions
Scroll the mouse wheel.
Args: direction: "up" or "down" amount: Number of scroll steps (default 3) x: X coordinate to scroll at (optional) y: Y coordinate to scroll at (optional)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| direction | No | down | |
| amount | No | ||
| x | No | ||
| y | No |
Implementation Reference
- hyprland_mcp/server.py:283-300 (handler)The mouse_scroll tool handler that accepts direction, amount, and optional coordinates, triggering cursor movement if needed and then the scroll action.
async def mouse_scroll( direction: str = "down", amount: int = 3, x: int | None = None, y: int | None = None, ) -> str: """Scroll the mouse wheel. Args: direction: "up" or "down" amount: Number of scroll steps (default 3) x: X coordinate to scroll at (optional) y: Y coordinate to scroll at (optional) """ from . import input as inp if x is not None and y is not None: await inp.move_cursor(x, y) await inp.scroll(direction, amount) - hyprland_mcp/input.py:60-73 (handler)The internal scroll helper function that uses ydotool to simulate the actual scroll event.
async def scroll(direction: str = "down", amount: int = 3) -> None: """Scroll the mouse wheel using ydotool.""" require_tool("ydotool") # ydotool mousemove --wheel: positive Y = down, negative Y = up y_val = amount if direction == "down" else -amount proc = await asyncio.create_subprocess_exec( "ydotool", "mousemove", "--wheel", "-x", "0", "-y", str(y_val), stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, ) _, stderr = await proc.communicate() if proc.returncode != 0: raise InputError(f"ydotool scroll failed: {stderr.decode().strip()}")