mouse_scroll
Scroll content up, down, left, or right by a specified number of clicks (default 3).
Instructions
Scroll in a direction (up/down/left/right) by N clicks (default 3).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| direction | Yes | ||
| amount | No | Number of scroll clicks. Default 3. |
Implementation Reference
- server.js:267-276 (handler)The mouseScroll function implements the tool logic: validates args, maps direction to button code via buttonCode(), calls xdotool click --repeat, and returns the result.
async function mouseScroll(args) { const missing = requireBin('xdotool'); if (missing) return errorResult(missing); const button = buttonCode(args.direction, true); if (!button) return errorResult(`unknown direction "${args.direction}" (expected up|down|left|right)`); const amount = Math.max(1, Math.floor(args.amount ?? 3)); const r = await run(BIN.xdotool, ['click', '--repeat', String(amount), button]); if (r.code !== 0) return errorResult(`mouse_scroll failed: ${r.stderr || r.stdout}`); return textResult({ direction: args.direction, amount }); } - server.js:476-487 (schema)The tool registration with inputSchema defines the direction enum (up/down/left/right) and optional amount number.
{ name: 'mouse_scroll', description: 'Scroll in a direction (up/down/left/right) by N clicks (default 3).', annotations: { title: 'Scroll mouse', destructiveHint: true }, inputSchema: { type: 'object', properties: { direction: { type: 'string', enum: ['up', 'down', 'left', 'right'] }, amount: { type: 'number', description: 'Number of scroll clicks. Default 3.' }, }, required: ['direction'], }, - server.js:562-562 (registration)The tool registration in the tools map, mapping the name 'mouse_scroll' to the mouseScroll function.
mouse_scroll: mouseScroll,