Skip to main content
Glama
LukeLamb

claude-linux-mcp

mouse_drag

Destructive

Drag mouse cursor from point (x1, y1) to (x2, y2) while holding a specified button (left, middle, or right).

Instructions

Drag from (x1, y1) to (x2, y2) while holding the given button (default left).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
x1Yes
y1Yes
x2Yes
y2Yes
buttonNoDefault: left.

Implementation Reference

  • The main handler function for the mouse_drag tool. Validates inputs, then uses xdotool to mousemove to (x1,y1), mousedown, mousemove to (x2,y2), and mouseup to perform a drag operation.
    async function mouseDrag(args) {
      const missing = requireBin('xdotool');
      if (missing) return errorResult(missing);
      const button = buttonCode(args.button || 'left');
      if (!button) return errorResult(`unknown button "${args.button}"`);
      for (const k of ['x1', 'y1', 'x2', 'y2']) {
        if (typeof args[k] !== 'number') return errorResult(`${k} is required (number)`);
      }
      const r = await run(BIN.xdotool, [
        'mousemove', String(args.x1), String(args.y1),
        'mousedown', button,
        'mousemove', String(args.x2), String(args.y2),
        'mouseup', button,
      ]);
      if (r.code !== 0) return errorResult(`mouse_drag failed: ${r.stderr || r.stdout}`);
      return textResult({ from: { x: args.x1, y: args.y1 }, to: { x: args.x2, y: args.y2 }, button: args.button || 'left' });
    }
  • The tool schema/registration entry defining the name, description, annotations, and inputSchema for the mouse_drag tool in the TOOLS array.
    {
      name: 'mouse_drag',
      description: 'Drag from (x1, y1) to (x2, y2) while holding the given button (default left).',
      annotations: { title: 'Drag mouse', destructiveHint: true },
      inputSchema: {
        type: 'object',
        properties: {
          x1: { type: 'number' }, y1: { type: 'number' },
          x2: { type: 'number' }, y2: { type: 'number' },
          button: { type: 'string', enum: ['left', 'middle', 'right'], description: 'Default: left.' },
        },
        required: ['x1', 'y1', 'x2', 'y2'],
      },
    },
  • server.js:561-561 (registration)
    The mapping of the tool name 'mouse_drag' to its handler function 'mouseDrag' in the HANDLERS dispatch object.
    mouse_drag: mouseDrag,
  • Helper function that maps button names ('left','middle','right') to xdotool button codes ('1','2','3'), used by mouse_drag to determine the button argument.
    function buttonCode(name, isScroll = false) {
      if (isScroll) {
        return { up: '4', down: '5', left: '6', right: '7' }[name] || null;
      }
      return { left: '1', middle: '2', right: '3' }[name] || null;
    }
Behavior3/5

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

The description explains the basic behavior of dragging with coordinates and a button. The annotations include destructiveHint: true, which warns of potential side effects. However, the description does not elaborate further on behavioral traits (e.g., coordinate system reference, effects on UI) beyond what the annotation already provides.

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 sentence of 15 words, efficiently conveying the core action and default button. No redundant information. Very concise.

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 tool has 5 parameters including coordinate pairs, the description lacks critical details such as coordinate reference frame (screen vs window), units (pixels?), what happens if coordinates are out of bounds, and return behavior. The destructive hint suggests potential side effects but these are not explained. The description is too minimal for full agent decision-making.

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?

Schema description coverage is 20% (only 'button' has a description). The description mentions the parameters but does not explain the coordinate system, units, or value ranges (e.g., are coordinates screen-relative?). The button options are listed but defaults are stated. The description fails to compensate for the low schema coverage.

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

Purpose5/5

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

Description clearly states the action: drag from (x1,y1) to (x2,y2) holding a button (default left). It uses a specific verb ('drag') and resource (coordinates), and is distinguishable from sibling tools like mouse_click and mouse_move.

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 explicit guidance on when to use this tool vs alternatives like mouse_click or mouse_move. No prerequisites or when-not-to-use instructions are provided. The destructive hint annotation offers some caution but not usage context.

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/LukeLamb/claude-linux-mcp'

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