Skip to main content
Glama

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
NameRequiredDescriptionDefault
xYesX coordinate in screen pixels (may be negative for secondary displays)
yYesY coordinate in screen pixels (may be negative for secondary displays)
buttonYesMouse button to click (default: left)left
click_countYesNumber of clicks: 1 (single), 2 (double), or 3 (triple)
modifiersNoModifier keys to hold during click

Implementation Reference

  • 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) }],
      };
    }
  • 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"),
    });
  • 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,
      },
    },

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/antbotlab/mac-use-mcp'

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