Skip to main content
Glama

click_by_uid

Click or double-click web elements in Firefox using unique identifiers for browser automation, testing, and scraping tasks.

Instructions

Click element by UID. Set dblClick for double-click.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesElement UID from snapshot
dblClickNoDouble-click (default: false)

Implementation Reference

  • Tool schema definition with name 'click_by_uid', description, and input schema requiring 'uid' (string) and optional 'dblClick' (boolean).
    export const clickByUidTool = {
      name: 'click_by_uid',
      description: 'Click element by UID. Set dblClick for double-click.',
      inputSchema: {
        type: 'object',
        properties: {
          uid: {
            type: 'string',
            description: 'Element UID from snapshot',
          },
          dblClick: {
            type: 'boolean',
            description: 'Double-click (default: false)',
          },
        },
        required: ['uid'],
      },
    };
  • MCP tool handler: validates arguments, imports and calls getFirefox(), executes firefox.clickByUid(uid, dblClick), handles UID errors with user-friendly messages, returns success or error response.
    export async function handleClickByUid(args: unknown): Promise<McpToolResponse> {
      try {
        const { uid, dblClick } = args as { uid: string; dblClick?: boolean };
    
        if (!uid || typeof uid !== 'string') {
          throw new Error('uid parameter is required and must be a string');
        }
    
        const { getFirefox } = await import('../index.js');
        const firefox = await getFirefox();
    
        try {
          await firefox.clickByUid(uid, dblClick);
          return successResponse(`✅ ${dblClick ? 'dblclick' : 'click'} ${uid}`);
        } catch (error) {
          throw handleUidError(error as Error, uid);
        }
      } catch (error) {
        return errorResponse(error as Error);
      }
    }
  • src/index.ts:130-147 (registration)
    Registration of click_by_uid handler in the toolHandlers Map used by the MCP server to route CallToolRequest to handleClickByUid.
      // Input
      ['click_by_uid', tools.handleClickByUid],
      ['hover_by_uid', tools.handleHoverByUid],
      ['fill_by_uid', tools.handleFillByUid],
      ['drag_by_uid_to_uid', tools.handleDragByUidToUid],
      ['fill_form_by_uid', tools.handleFillFormByUid],
      ['upload_file_by_uid', tools.handleUploadFileByUid],
    
      // Screenshot
      ['screenshot_page', tools.handleScreenshotPage],
      ['screenshot_by_uid', tools.handleScreenshotByUid],
    
      // Utilities
      ['accept_dialog', tools.handleAcceptDialog],
      ['dismiss_dialog', tools.handleDismissDialog],
      ['navigate_history', tools.handleNavigateHistory],
      ['set_viewport_size', tools.handleSetViewportSize],
    ]);
  • src/index.ts:174-181 (registration)
    Registration of clickByUidTool schema in the allTools array returned by ListToolsRequest.
    // Input
    tools.clickByUidTool,
    tools.hoverByUidTool,
    tools.fillByUidTool,
    tools.dragByUidToUidTool,
    tools.fillFormByUidTool,
    tools.uploadFileByUidTool,
  • Low-level implementation in DomInteractions class: resolves UID to WebElement, waits for visibility, performs click or doubleClick using Selenium actions, waits for event propagation.
    async clickByUid(uid: string, dblClick = false): Promise<void> {
      if (!this.resolveUid) {
        throw new Error('clickByUid: resolveUid callback not set. Ensure snapshot is initialized.');
      }
      const el = await this.resolveUid(uid);
      await this.driver.wait(until.elementIsVisible(el), 5000).catch(() => {});
    
      if (dblClick) {
        await this.driver.actions({ async: true }).doubleClick(el).perform();
      } else {
        await el.click();
      }
    
      // Wait for events to propagate
      await this.waitForEventsAfterAction();
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the double-click option but fails to describe what happens after clicking (e.g., page navigation, element state changes, error handling), whether it waits for page loads, or any side effects. This is inadequate for a tool that performs UI interactions.

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 extremely concise with only two short sentences that directly address the tool's core functionality and a key parameter. Every word earns its place, and it's front-loaded with the primary action, making it efficient and easy to scan.

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?

Given the complexity of a UI interaction tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral outcomes, error conditions, dependencies (e.g., needing a snapshot), or what the tool returns. This leaves significant gaps for an agent to use it effectively in automation scenarios.

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%, so the schema already documents both parameters ('uid' and 'dblClick') fully. The description adds minimal value by restating the 'dblClick' parameter's purpose without providing additional context beyond what the schema says, such as when double-clicking is appropriate or how UIDs are obtained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Click element') and target ('by UID'), making the purpose immediately understandable. However, it doesn't explicitly distinguish this tool from sibling tools like 'hover_by_uid' or 'drag_by_uid_to_uid', which also interact with elements by UID but perform different actions.

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

Usage Guidelines3/5

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

The description implies usage by mentioning the 'dblClick' parameter for double-clicking, suggesting when to use that option. However, it provides no explicit guidance on when to choose this tool over alternatives like 'hover_by_uid' or 'drag_by_uid_to_uid', nor does it mention prerequisites such as needing a snapshot or UID from tools like 'take_snapshot'.

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/mozilla/firefox-devtools-mcp'

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