Skip to main content
Glama

browser_click

Destructive

Click elements on web pages to automate interactions. Specify target elements and click options like double-click or button type for precise control.

Instructions

Perform click on a web page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementYesHuman-readable element description used to obtain permission to interact with the element
refYesExact target element reference from the page snapshot
doubleClickNoWhether to perform a double click instead of a single click
buttonNoButton to click, defaults to left

Implementation Reference

  • Handler function that resolves the element locator from the provided reference and parameters, generates corresponding Playwright code for click or double-click, and executes the action while waiting for completion.
    handle: async (tab, params, response) => {
      response.setIncludeSnapshot();
    
      const locator = await tab.refLocator(params);
      const button = params.button;
      const buttonAttr = button ? `{ button: '${button}' }` : '';
    
      if (params.doubleClick)
        response.addCode(`await page.${await generateLocator(locator)}.dblclick(${buttonAttr});`);
      else
        response.addCode(`await page.${await generateLocator(locator)}.click(${buttonAttr});`);
    
    
      await tab.waitForCompletion(async () => {
        if (params.doubleClick)
          await locator.dblclick({ button });
        else
          await locator.click({ button });
      });
    },
  • Schema definition for the browser_click tool, including name, title, description, input schema (clickSchema which extends elementSchema), and type.
    schema: {
      name: 'browser_click',
      title: 'Click',
      description: 'Perform click on a web page',
      inputSchema: clickSchema,
      type: 'destructive',
    },
  • src/tools.ts:36-52 (registration)
    Registration of all tools including the browser_click tool (via ...snapshot import at line 27), collected into allTools array used by filteredTools and browser backend.
    export const allTools: Tool<any>[] = [
      ...common,
      ...console,
      ...dialogs,
      ...evaluate,
      ...files,
      ...install,
      ...keyboard,
      ...navigate,
      ...network,
      ...mouse,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs,
      ...wait,
    ];
  • Specific input schema for click tool options, extending the shared elementSchema.
    const clickSchema = elementSchema.extend({
      doubleClick: z.boolean().optional().describe('Whether to perform a double click instead of a single click'),
      button: z.enum(['left', 'right', 'middle']).optional().describe('Button to click, defaults to left'),
    });
  • In the BrowserServerBackend constructor, tools are set using filteredTools which includes browser_click, and later exposed via tools() and called in callTool.
    this._tools = filteredTools(config);
Behavior4/5

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

Annotations indicate destructiveHint=true and readOnlyHint=false, which the description aligns with by implying a click performs an action. The description adds minimal behavioral context beyond annotations, but it doesn't contradict them. It could enhance transparency by noting potential side effects like navigation or form submissions.

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 waste. It's front-loaded and appropriately sized for the tool's complexity, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, destructive operation) and no output schema, the description is minimal but not inadequate. Annotations cover key behavioral traits, but the description could better address context like error handling or typical use cases. It meets a basic threshold but lacks depth.

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 parameters are fully documented in the schema. The description adds no additional meaning about parameters like 'element' or 'ref', nor does it explain their interplay. Baseline score of 3 is appropriate as the schema carries the burden.

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

Purpose3/5

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

The description 'Perform click on a web page' clearly states the action (click) and target (web page), but it's vague about what exactly gets clicked and doesn't differentiate from siblings like browser_hover, browser_drag, or browser_press_key. It lacks specificity about interacting with page elements versus general clicking.

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. The description doesn't mention prerequisites (e.g., needing a page snapshot from browser_snapshot), exclusions, or comparisons to siblings like browser_hover for hovering or browser_press_key for keyboard interactions. Usage context is implied but not explicit.

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/maywzh/playwright-mcp'

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