Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

moveMouse

Move the mouse cursor to specific coordinates on screen for browser automation tasks like web scraping, testing, and interaction.

Instructions

Move mouse to coordinates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYes
yYes

Implementation Reference

  • Core handler function that performs the actual mouse movement using Playwright's page.mouse.move method. Updates current mouse position and includes error handling.
    async moveMouse(x: number, y: number): Promise<void> {
      try {
        if (!this.isInitialized()) {
          throw new Error('Browser not initialized');
        }
        this.log('Moving mouse to', { 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 within viewport');
      }
    }
  • MCP tool call handler in the server's request handler. Validates inputs and delegates to the Playwright controller's moveMouse method.
    case 'moveMouse': {
      if (typeof args.x !== 'number' || typeof args.y !== 'number') {
        return {
          content: [{ type: "text", text: "X and Y coordinates are required" }],
          isError: true
        };
      }
      await playwrightController.moveMouse(args.x, args.y);
      return {
        content: [{ type: "text", text: "Mouse moved successfully" }]
      };
    }
  • Defines the tool schema including name, description, and input validation schema for x and y coordinates.
    const MOVE_MOUSE_TOOL: Tool = {
      name: "moveMouse",
      description: "Move mouse to coordinates",
      inputSchema: {
        type: "object",
        properties: {
          x: { type: "number" },
          y: { type: "number" }
        },
        required: ["x", "y"]
      }
    };
  • src/server.ts:514-553 (registration)
    Registers the moveMouse tool (as MOVE_MOUSE_TOOL) in the tools dictionary passed to MCP server capabilities.
    const tools = {
      openBrowser: OPEN_BROWSER_TOOL,
      navigate: NAVIGATE_TOOL,
      type: TYPE_TOOL,
      click: CLICK_TOOL,
      moveMouse: MOVE_MOUSE_TOOL,
      scroll: SCROLL_TOOL,
      screenshot: SCREENSHOT_TOOL,
      getPageSource: GET_PAGE_SOURCE_TOOL,
      getPageText: GET_PAGE_TEXT_TOOL,
      getPageTitle: GET_PAGE_TITLE_TOOL,
      getPageUrl: GET_PAGE_URL_TOOL,
      getScripts: GET_SCRIPTS_TOOL,
      getStylesheets: GET_STYLESHEETS_TOOL,
      getMetaTags: GET_META_TAGS_TOOL,
      getLinks: GET_LINKS_TOOL,
      getImages: GET_IMAGES_TOOL,
      getForms: GET_FORMS_TOOL,
      getElementContent: GET_ELEMENT_CONTENT_TOOL,
      getElementHierarchy: GET_ELEMENT_HIERARCHY_TOOL,
      executeJavaScript: EXECUTE_JAVASCRIPT_TOOL,
      goForward: GO_FORWARD_TOOL,
      hover: HOVER_TOOL,
      dragAndDrop: DRAG_AND_DROP_TOOL,
      selectOption: SELECT_OPTION_TOOL,
      pressKey: PRESS_KEY_TOOL,
      waitForText: WAIT_FOR_TEXT_TOOL,
      waitForSelector: WAIT_FOR_SELECTOR_TOOL,
      resize: RESIZE_TOOL,
      handleDialog: HANDLE_DIALOG_TOOL,
      getConsoleMessages: GET_CONSOLE_MESSAGES_TOOL,
      getNetworkRequests: GET_NETWORK_REQUESTS_TOOL,
      uploadFiles: UPLOAD_FILES_TOOL,
      evaluateWithReturn: EVALUATE_WITH_RETURN_TOOL,
      takeScreenshot: TAKE_SCREENSHOT_TOOL,
      mouseMove: MOUSE_MOVE_TOOL,
      mouseClick: MOUSE_CLICK_TOOL,
      mouseDrag: MOUSE_DRAG_TOOL,
      closeBrowser: CLOSE_BROWSER_TOOL
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action but doesn't describe what happens after moving the mouse (e.g., whether it triggers events, requires browser focus, or has side effects). For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single, front-loaded sentence that directly states the tool's purpose. There is no wasted verbiage, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a mouse interaction tool with no annotations, no output schema, and low parameter semantics, the description is incomplete. It doesn't cover behavioral aspects, coordinate system details, or usage context, making it inadequate for effective tool selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'coordinates' but doesn't explain what 'x' and 'y' represent (e.g., screen pixels, relative to viewport, absolute positions). With 0% schema description coverage and two required parameters, the description adds minimal value beyond what the schema provides, failing to compensate for the coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Move mouse to coordinates' clearly states the action (move) and target (mouse), but it's vague about the coordinate system and lacks differentiation from sibling tools like 'mouseMove' or 'mouseDrag'. It specifies the verb and resource but doesn't provide enough context to distinguish it from similar tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'mouseMove', 'hover', or 'mouseDrag'. The description doesn't mention any prerequisites, context, or exclusions, leaving the agent with no usage instructions beyond the basic action.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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