Skip to main content
Glama

click

Automate desktop app testing by clicking UI elements using CSS selectors or element references within Tauri applications.

Instructions

Click element by ref or selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoRef from snapshot
selectorNoCSS selector
windowNoWindow label (default: focused window)

Implementation Reference

  • The click tool handler that validates input (requires either ref or selector), calls socketManager.click(), and formats the response as MCP content
    click: async (args: { ref?: number; selector?: string; window?: string }) => { if (!args.ref && !args.selector) { throw new Error('Either ref or selector must be provided'); } const result = await socketManager.click(args); return { content: [ { type: 'text' as const, text: result, }, ], }; },
  • Schema definition for the click tool with name, description, and inputSchema validating optional ref, selector, and window parameters using Zod
    click: { name: 'click', description: 'Click element by ref or selector', inputSchema: z.object({ ref: z.number().optional().describe('Ref from snapshot'), selector: z.string().optional().describe('CSS selector'), window: z.string().optional().describe('Window label (default: focused window)'), }), },
  • Implementation of the click functionality in SocketManager that sends the click command via socket and handles success/error responses
    async click(options: { ref?: number; selector?: string; window?: string }): Promise<string> { const result = await this.sendCommand('click', options) as { success: boolean; error?: string }; if (!result.success) { throw new Error(result.error || 'Click failed'); } const target = options.ref ? `ref=${options.ref}` : options.selector; const windowInfo = options.window ? ` in window '${options.window}'` : ''; return `Clicked ${target}${windowInfo}`; }
  • Click tool registered in DEFAULT_ESSENTIAL_TOOLS array, making it available in the MCP server's tool list
    const DEFAULT_ESSENTIAL_TOOLS = [ 'app_status', 'launch_app', 'stop_app', 'snapshot', 'click', 'fill', 'screenshot', 'navigate', ];

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/DaveDev42/tauri-plugin-mcp'

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