Skip to main content
Glama

humanizer_move

Simulate realistic mouse movements to target coordinates using human-like Bezier curves with Fitts's law velocity scaling and eased timing profiles.

Instructions

Move mouse along a human-like Bezier curve to target coordinates. Uses Fitts's law velocity scaling and eased timing profile.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_idYesChrome target ID from interceptor_chrome_launch
xYesDestination X coordinate
yYesDestination Y coordinate
duration_msNoBase duration in ms before Fitts scaling (default: 600)

Implementation Reference

  • The core `moveMouse` method which handles the mouse movement logic by generating a Bezier curve path and dispatching CDP mouse events.
    async moveMouse(
      targetId: string,
      x: number,
      y: number,
      durationMs?: number,
    ): Promise<{ totalMs: number; eventsDispatched: number }> {
      const state = await this.getSession(targetId);
      const from: Point = { x: state.mouseX, y: state.mouseY };
      const to: Point = { x, y };
    
      const path = generatePath(from, to, {
        baseDurationMs: durationMs ?? 600,
      });
    
      let eventsDispatched = 0;
      for (let i = 0; i < path.points.length; i++) {
        const pt = path.points[i];
    
        // Wait inter-point delay
        if (i > 0) {
          const delay = path.timestamps[i] - path.timestamps[i - 1];
          if (delay > 0) await sleep(delay);
        }
    
        await state.session.send("Input.dispatchMouseEvent", {
          type: "mouseMoved",
          x: pt.x,
          y: pt.y,
          button: "none",
          buttons: 0,
        });
        eventsDispatched++;
      }
    
      // Update tracked position
      const lastPt = path.points[path.points.length - 1];
      state.mouseX = lastPt.x;
      state.mouseY = lastPt.y;
    
      return { totalMs: path.totalMs, eventsDispatched };
    }
  • Registration of the 'humanizer_move' MCP tool, which parses arguments and calls the engine's moveMouse method.
    server.tool(
      "humanizer_move",
      "Move mouse along a human-like Bezier curve to target coordinates. " +
      "Uses Fitts's law velocity scaling and eased timing profile.",
      {
        target_id: z.string().describe("Chrome target ID from interceptor_chrome_launch"),
        x: z.number().describe("Destination X coordinate"),
        y: z.number().describe("Destination Y coordinate"),
        duration_ms: z.number().optional().default(600)
          .describe("Base duration in ms before Fitts scaling (default: 600)"),
      },
      async ({ target_id, x, y, duration_ms }) => {
        try {
          const result = await humanizerEngine.moveMouse(target_id, x, y, duration_ms);
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                status: "success",
                target_id,
                action: "move",
                destination: { x, y },
                stats: {
                  total_ms: result.totalMs,
                  events_dispatched: result.eventsDispatched,
                },
              }),
            }],
          };
        } catch (e) {
          return {
            content: [{
              type: "text",
              text: JSON.stringify({ status: "error", target_id, action: "move", error: errorToString(e) }),
            }],
          };
        }
      },
    );
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