humanizer_scroll
Simulates human-like scrolling behavior in browsers by generating natural acceleration and deceleration patterns using easeInOutQuad velocity distribution.
Instructions
Scroll with natural acceleration/deceleration using easeInOutQuad velocity distribution. Dispatches multiple wheel events to simulate human scroll behavior.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target_id | Yes | Chrome target ID from interceptor_chrome_launch | |
| delta_y | Yes | Vertical scroll delta in pixels (positive = scroll down) | |
| delta_x | No | Horizontal scroll delta in pixels (default: 0) | |
| duration_ms | No | Total scroll duration in ms (default: 400) |
Implementation Reference
- src/humanizer/engine.ts:419-452 (handler)The 'scroll' method in HumanizerEngine calculates scroll steps and dispatches mouseWheel events to the target session.
async scroll( targetId: string, deltaY: number, deltaX?: number, durationMs?: number, ): Promise<{ totalMs: number; eventsDispatched: number }> { const state = await this.getSession(targetId); const scrollSteps = calculateScrollSteps({ deltaY, deltaX, durationMs: durationMs ?? 400, }); let totalMs = 0; let eventsDispatched = 0; for (const step of scrollSteps) { await sleep(step.delayMs); totalMs += step.delayMs; await state.session.send("Input.dispatchMouseEvent", { type: "mouseWheel", x: state.mouseX, y: state.mouseY, deltaX: step.deltaX, deltaY: step.deltaY, button: "none", buttons: 0, }); eventsDispatched++; } return { totalMs, eventsDispatched }; } - src/tools/humanizer.ts:171-200 (registration)The 'humanizer_scroll' tool is registered in the server, accepting input parameters like delta_y and duration_ms, and calls the HumanizerEngine.scroll method.
server.tool( "humanizer_scroll", "Scroll with natural acceleration/deceleration using easeInOutQuad velocity distribution. " + "Dispatches multiple wheel events to simulate human scroll behavior.", { target_id: z.string().describe("Chrome target ID from interceptor_chrome_launch"), delta_y: z.number().describe("Vertical scroll delta in pixels (positive = scroll down)"), delta_x: z.number().optional().default(0) .describe("Horizontal scroll delta in pixels (default: 0)"), duration_ms: z.number().optional().default(400) .describe("Total scroll duration in ms (default: 400)"), }, async ({ target_id, delta_y, delta_x, duration_ms }) => { try { const result = await humanizerEngine.scroll(target_id, delta_y, delta_x, duration_ms); return { content: [{ type: "text", text: JSON.stringify({ status: "success", target_id, action: "scroll", delta: { x: delta_x, y: delta_y }, stats: { total_ms: result.totalMs, events_dispatched: result.eventsDispatched, }, }), }], };