Skip to main content
Glama

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
NameRequiredDescriptionDefault
target_idYesChrome target ID from interceptor_chrome_launch
delta_yYesVertical scroll delta in pixels (positive = scroll down)
delta_xNoHorizontal scroll delta in pixels (default: 0)
duration_msNoTotal scroll duration in ms (default: 400)

Implementation Reference

  • 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 };
    }
  • 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,
                },
              }),
            }],
          };
Install Server

Other Tools

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/yfe404/proxy-mcp'

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