click
Perform mouse clicks at specified screen coordinates with configurable button, click count, and modifier keys for macOS automation tasks.
Instructions
Click at the specified screen coordinates. Supports left/right/middle button, single/double/triple click, and modifier keys. Do not narrate visual observations or coordinate calculations. Brief task progress updates are acceptable.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X coordinate in screen pixels (may be negative for secondary displays) | |
| y | Yes | Y coordinate in screen pixels (may be negative for secondary displays) | |
| button | Yes | Mouse button to click (default: left) | left |
| click_count | Yes | Number of clicks: 1 (single), 2 (double), or 3 (triple) | |
| modifiers | No | Modifier keys to hold during click |
Implementation Reference
- src/tools/mouse.ts:195-223 (handler)The implementation of the `click` tool handler. It parses the arguments using `ClickInputSchema`, executes the click using `runInputHelper`, and formats the response.
async function handleClick( args: Record<string, unknown>, ): Promise<CallToolResult> { const parsed = ClickInputSchema.parse(args); const result = await runInputHelper("click", { x: parsed.x, y: parsed.y, button: parsed.button, count: parsed.click_count, ...(parsed.modifiers && parsed.modifiers.length > 0 ? { modifiers: parsed.modifiers } : {}), }); const response: Record<string, unknown> = { clicked: { x: parsed.x, y: parsed.y }, button: parsed.button, click_count: parsed.click_count, modifiers: parsed.modifiers ?? [], }; if (typeof result.warning === "string") { response.warning = result.warning; } return { content: [{ type: "text" as const, text: JSON.stringify(response) }], }; } - src/tools/mouse.ts:36-64 (schema)Input validation schema for the `click` tool.
const ClickInputSchema = z.object({ x: z .number() .int() .describe( "X coordinate in screen pixels (may be negative for secondary displays)", ), y: z .number() .int() .describe( "Y coordinate in screen pixels (may be negative for secondary displays)", ), button: z .enum(MOUSE_BUTTONS) .default("left") .describe("Mouse button to click (default: left)"), click_count: z .number() .int() .min(1) .max(3) .default(1) .describe("Number of clicks: 1 (single), 2 (double), or 3 (triple)"), modifiers: z .array(z.enum(CLICK_MODIFIERS)) .optional() .describe("Modifier keys to hold during click"), }); - src/tools/mouse.ts:145-153 (registration)Registration of the `click` tool definition within `mouseToolDefinitions`.
{ name: "click", description: `Click at the specified screen coordinates. Supports left/right/middle button, single/double/triple click, and modifier keys. ${SILENT_HINT}`, inputSchema: zodToToolInputSchema(ClickInputSchema), annotations: { readOnlyHint: false, destructiveHint: true, }, },