Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

mouseMove

Move the mouse cursor to precise screen coordinates (x, y) for precise browser automation tasks. Part of the PlayMCP Browser Automation Server for accurate web interaction.

Instructions

Move mouse to specific coordinates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYes
yYes

Implementation Reference

  • The core handler function that executes the mouse movement logic using Playwright's page.mouse.move API.
    async mouseMove(x: number, y: number): Promise<void> { try { if (!this.isInitialized() || !this.state.page) { throw new Error('Browser not initialized'); } this.log('Moving mouse', { x, y }); await this.state.page.mouse.move(x, y); this.currentMousePosition = { x, y }; this.log('Mouse move complete'); } catch (error: any) { console.error('Mouse move error:', error); throw new BrowserError('Failed to move mouse', 'Check if coordinates are valid'); } }
  • Defines the tool's metadata, including input schema for parameters x and y (numbers).
    const MOUSE_MOVE_TOOL: Tool = { name: "mouseMove", description: "Move mouse to specific coordinates", inputSchema: { type: "object", properties: { x: { type: "number" }, y: { type: "number" } }, required: ["x", "y"] } };
  • src/server.ts:549-549 (registration)
    Registers the mouseMove tool in the tools object, which is provided to the MCP server's capabilities.
    mouseMove: MOUSE_MOVE_TOOL,
  • MCP callTool request handler case that performs input validation and delegates execution to the Playwright controller.
    case 'mouseMove': { if (typeof args.x !== 'number' || typeof args.y !== 'number') { return { content: [{ type: "text", text: "X and Y coordinates are required" }], isError: true }; } await playwrightController.mouseMove(args.x, args.y); return { content: [{ type: "text", text: "Mouse moved successfully" }] }; }

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/jomon003/PlayMCP'

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