Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

mouseDrag

Simulate mouse drag actions in browser automation by specifying start and end coordinates for precise control during web scraping and testing.

Instructions

Drag from one coordinate to another

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startXYes
startYYes
endXYes
endYYes

Implementation Reference

  • The core implementation of the mouseDrag tool in the PlaywrightController class. It moves the mouse to start position, presses down, moves to end position, and releases.
    async mouseDrag(startX: number, startY: number, endX: number, endY: number): Promise<void> {
      try {
        if (!this.isInitialized() || !this.state.page) {
          throw new Error('Browser not initialized');
        }
        this.log('Mouse drag', { startX, startY, endX, endY });
        await this.state.page.mouse.move(startX, startY);
        await this.state.page.mouse.down();
        await this.state.page.mouse.move(endX, endY);
        await this.state.page.mouse.up();
        this.currentMousePosition = { x: endX, y: endY };
        this.log('Mouse drag complete');
      } catch (error: any) {
        console.error('Mouse drag error:', error);
        throw new BrowserError('Failed to drag mouse', 'Check if coordinates are valid');
      }
    }
  • The input schema and metadata for the mouseDrag tool, defining required numeric parameters for drag coordinates.
    const MOUSE_DRAG_TOOL: Tool = {
      name: "mouseDrag",
      description: "Drag from one coordinate to another",
      inputSchema: {
        type: "object",
        properties: {
          startX: { type: "number" },
          startY: { type: "number" },
          endX: { type: "number" },
          endY: { type: "number" }
        },
        required: ["startX", "startY", "endX", "endY"]
      }
    };
  • src/server.ts:984-996 (registration)
    The dispatch case in the MCP callTool request handler that validates inputs and invokes the mouseDrag handler.
    case 'mouseDrag': {
      if (typeof args.startX !== 'number' || typeof args.startY !== 'number' || 
          typeof args.endX !== 'number' || typeof args.endY !== 'number') {
        return {
          content: [{ type: "text", text: "Start and end coordinates are required" }],
          isError: true
        };
      }
      await playwrightController.mouseDrag(args.startX, args.startY, args.endX, args.endY);
      return {
        content: [{ type: "text", text: "Mouse drag completed successfully" }]
      };
    }
  • src/server.ts:551-551 (registration)
    Registration of the mouseDrag tool in the tools capabilities object passed to the MCP Server.
    mouseDrag: MOUSE_DRAG_TOOL,
Behavior1/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 only states the action ('drag') without explaining what happens during the drag (e.g., mouse button press/movement/release, visual feedback, interaction with page elements), potential side effects, or error conditions. This is inadequate for a tool that likely involves UI interaction.

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 a single, efficient sentence with zero wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly.

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

Completeness1/5

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

Given the complexity of a UI interaction tool with no annotations, no output schema, and 4 undocumented parameters, the description is severely incomplete. It fails to explain the tool's behavior, return values, or practical usage context, making it inadequate for an agent to use correctly.

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 input schema has 4 parameters (startX, startY, endX, endY) with 0% description coverage, meaning no parameter details are documented in the schema. The description adds minimal semantics by implying these are coordinates for dragging, but doesn't specify units (e.g., pixels), coordinate system (e.g., viewport vs. page), or valid ranges. It partially compensates but leaves critical gaps.

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 'Drag from one coordinate to another' clearly indicates the action (drag) and the resource (coordinates), but it's vague about what exactly is being dragged (mouse cursor vs. element) and doesn't distinguish from sibling tools like 'dragAndDrop' or 'moveMouse'. It states the basic purpose but lacks specificity.

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?

The description provides no guidance on when to use this tool versus alternatives like 'dragAndDrop' or 'moveMouse'. There's no mention of context, prerequisites, or exclusions, leaving the agent to infer usage from the name alone.

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