Skip to main content
Glama
Radek44

MCP Tauri Automation

by Radek44

click_element

Automate UI interactions in Tauri desktop applications by clicking elements identified with CSS selectors, enabling automated testing without manual input.

Instructions

Click a UI element identified by a CSS selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector to identify the element to click (e.g., "#button-id", ".button-class", "button[name=submit]")

Implementation Reference

  • Primary handler function for the 'click_element' tool. It receives the driver instance and parameters, delegates to the driver's clickElement method, and formats the response as ToolResponse with success/error handling.
    export async function clickElement(
      driver: TauriDriver,
      params: ElementSelector
    ): Promise<ToolResponse<{ message: string }>> {
      try {
        await driver.clickElement(params.selector);
    
        return {
          success: true,
          data: {
            message: `Clicked element: ${params.selector}`,
          },
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : String(error),
        };
      }
    }
  • Core implementation of element clicking using WebDriverIO. Finds the element by CSS selector, checks existence, and performs the click action.
    async clickElement(selector: string): Promise<void> {
      this.ensureAppRunning();
    
      const element = await this.appState.browser!.$(selector);
      if (!(await element.isExisting())) {
        throw new Error(`Element not found: ${selector}`);
      }
    
      await element.click();
    }
  • src/index.ts:102-115 (registration)
    Registers the 'click_element' tool in the MCP ListTools response, including name, description, and input schema.
    {
      name: 'click_element',
      description: 'Click a UI element identified by a CSS selector',
      inputSchema: {
        type: 'object',
        properties: {
          selector: {
            type: 'string',
            description: 'CSS selector to identify the element to click (e.g., "#button-id", ".button-class", "button[name=submit]")',
          },
        },
        required: ['selector'],
      },
    },
  • MCP CallToolRequest dispatcher case for 'click_element', invokes the clickElement handler and returns the result as MCP content.
    case 'click_element': {
      const result = await clickElement(driver, args as any);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the 'click_element' tool, specifying the required 'selector' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        selector: {
          type: 'string',
          description: 'CSS selector to identify the element to click (e.g., "#button-id", ".button-class", "button[name=submit]")',
        },
      },
      required: ['selector'],
    },
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral context. It doesn't mention whether this requires the app to be launched first, what happens if the element isn't found (e.g., error behavior), or if it waits for the element to be clickable. This leaves critical gaps for a UI automation tool.

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, efficient sentence with zero wasted words. It's front-loaded with the core action and uses clear, direct language appropriate for a simple tool.

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?

For a UI interaction tool with no annotations and no output schema, the description is incomplete. It lacks context about prerequisites (e.g., app must be launched), error handling, or what constitutes success, which are essential for reliable use alongside siblings like launch_app or wait_for_element.

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

Parameters3/5

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

Schema description coverage is 100%, with the schema fully documenting the single parameter's type, requirement, and examples. The description adds no additional parameter semantics beyond what's in the schema, meeting the baseline for high 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?

The description clearly states the specific action ('Click') and target ('a UI element identified by a CSS selector'), distinguishing it from siblings like type_text (typing) or get_element_text (reading). It uses precise terminology that directly maps to the tool's function.

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 guidance is provided on when to use this tool versus alternatives like execute_tauri_command (which might handle clicks differently) or wait_for_element (which might be a prerequisite). The description only states what it does, not when it's appropriate.

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/Radek44/mcp-tauri-automation'

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