Skip to main content
Glama
LukeLamb

claude-linux-mcp

mouse_click

Destructive

Clicks a mouse button. Optionally moves the pointer to specified x,y coordinates before clicking.

Instructions

Click a mouse button. If x and y are provided, the pointer moves there first; otherwise clicks at the current pointer location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buttonNoDefault: left.
xNo
yNo

Implementation Reference

  • The main handler function for the mouse_click tool. It validates the xdotool binary, resolves the button code (left/middle/right), optionally moves the mouse to (x,y) coordinates, then executes the click via xdotool.
    async function mouseClick(args) {
      const missing = requireBin('xdotool');
      if (missing) return errorResult(missing);
      const button = buttonCode(args.button || 'left');
      if (!button) return errorResult(`unknown button "${args.button}" (expected left|middle|right)`);
      const cmd = [];
      if (typeof args.x === 'number' && typeof args.y === 'number') {
        cmd.push('mousemove', String(args.x), String(args.y));
      }
      cmd.push('click', button);
      const r = await run(BIN.xdotool, cmd);
      if (r.code !== 0) return errorResult(`mouse_click failed: ${r.stderr || r.stdout}`);
      return textResult({ button: args.button || 'left', x: args.x ?? null, y: args.y ?? null });
    }
  • Schema/registration definition for the mouse_click tool. Defines the tool name, description, and inputSchema with optional button (left/middle/right), x, and y fields.
    {
      name: 'mouse_click',
      description: 'Click a mouse button. If x and y are provided, the pointer moves there first; otherwise clicks at the current pointer location.',
      annotations: { title: 'Click mouse', destructiveHint: true },
      inputSchema: {
        type: 'object',
        properties: {
          button: { type: 'string', enum: ['left', 'middle', 'right'], description: 'Default: left.' },
          x: { type: 'number' },
          y: { type: 'number' },
        },
      },
    },
  • server.js:560-560 (registration)
    Registration of the mouse_click handler in the HANDLERS map, mapping the tool name 'mouse_click' to the mouseClick function.
    mouse_click: mouseClick,
  • Helper function that maps human-readable button names ('left', 'middle', 'right') to xdotool numeric button codes ('1', '2', '3'). Used by mouse_click and other mouse tools.
    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;
    }
Behavior4/5

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

The description adds value beyond annotations by explaining the conditional pointer movement. Annotations provide destructiveHint for safety awareness, and the description complements this with operational detail.

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?

A single, well-structured sentence that front-loads the key purpose and critical behavior. No unnecessary words.

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

Completeness4/5

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

For a simple action tool with no output schema, the description covers the main behavior and parameter interaction. It assumes agent awareness of standard UI concepts, which is reasonable.

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

Parameters4/5

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

The description explains the role of x and y together (pointer movement before click), adding context beyond the schema's minimal descriptions. For button, the schema already provides default, so the description doesn't need repetition.

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?

The description clearly states the tool clicks a mouse button, with optional movement to specified coordinates. It effectively distinguishes from sibling tools like 'mouse_move' and 'mouse_drag' by specifying its unique action.

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

Usage Guidelines4/5

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

The description implies when to use this tool (for clicking) versus alternatives like mouse_move or mouse_drag. However, it does not explicitly state when not to use it or mention any prerequisites.

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