Skip to main content
Glama

browser_click

Click on web page elements using selectors to interact with browser instances in parallel testing or automation workflows.

Instructions

Click on a page element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceIdYesInstance ID
selectorYesElement selector
buttonNoMouse buttonleft
clickCountNoNumber of clicks
delayNoClick delay in milliseconds
timeoutNoTimeout in milliseconds

Implementation Reference

  • The primary handler function that executes the browser_click tool logic by retrieving the browser instance and performing the click operation using Playwright's page.click() method with specified options.
    private async click(instanceId: string, selector: string, options: ClickOptions): Promise<ToolResult> {
      const instance = this.browserManager.getInstance(instanceId);
      if (!instance) {
        return { success: false, error: `Instance ${instanceId} not found` };
      }
    
      try {
        const clickOptions: any = {
          button: options.button
        };
        if (options.clickCount) clickOptions.clickCount = options.clickCount;
        if (options.delay) clickOptions.delay = options.delay;
        if (options.timeout) clickOptions.timeout = options.timeout;
        await instance.page.click(selector, clickOptions);
        return {
          success: true,
          data: { selector, clicked: true },
          instanceId
        };
      } catch (error) {
        return {
          success: false,
          error: `Click failed: ${error instanceof Error ? error.message : error}`,
          instanceId
        };
      }
    }
  • The JSON input schema definition for the browser_click tool, specifying required parameters (instanceId, selector) and optional parameters (button, clickCount, delay, timeout).
    {
      name: 'browser_click',
      description: 'Click on a page element',
      inputSchema: {
        type: 'object',
        properties: {
          instanceId: {
            type: 'string',
            description: 'Instance ID'
          },
          selector: {
            type: 'string',
            description: 'Element selector',
          },
          button: {
            type: 'string',
            enum: ['left', 'right', 'middle'],
            description: 'Mouse button',
            default: 'left'
          },
          clickCount: {
            type: 'number',
            description: 'Number of clicks',
            default: 1
          },
          delay: {
            type: 'number',
            description: 'Click delay in milliseconds',
            default: 0
          },
          timeout: {
            type: 'number',
            description: 'Timeout in milliseconds',
            default: 30000
          }
        },
        required: ['instanceId', 'selector']
      }
    },
  • src/tools.ts:533-540 (registration)
    The dispatcher case in the executeTools method that handles browser_click tool calls and invokes the click handler with parsed arguments.
    case 'browser_click':
      return await this.click(args.instanceId, args.selector, {
        button: args.button || 'left',
        clickCount: args.clickCount || 1,
        delay: args.delay || 0,
        timeout: args.timeout || 30000
      });
  • src/server.ts:40-45 (registration)
    MCP server registration for listing tools; returns the browser_click tool definition via BrowserTools.getTools().
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      const tools = this.browserTools.getTools();
      return {
        tools: tools,
      };
    });
  • src/server.ts:48-75 (registration)
    MCP server registration for tool calls; dispatches browser_click calls to BrowserTools.executeTools() and returns the result.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      try {
        const result = await this.browserTools.executeTools(name, args || {});
        
        if (result.success) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(result.data, null, 2),
              },
            ],
          };
        } else {
          throw new McpError(ErrorCode.InternalError, result.error || 'Tool execution failed');
        }
      } catch (error) {
        if (error instanceof McpError) {
          throw error;
        }
        throw new McpError(
          ErrorCode.InternalError,
          `Tool execution failed: ${error instanceof Error ? error.message : error}`
        );
      }
    });
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the basic action but doesn't disclose critical traits like error handling (what happens if selector fails), side effects (page navigation after click), or performance considerations (timeout behavior). This leaves significant gaps for a mutation 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 extremely concise at just four words, front-loading the core action without any wasted text. Every word earns its place by communicating the essential purpose efficiently.

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 mutation tool with 6 parameters, no annotations, and no output schema, the description is inadequate. It lacks information about behavioral outcomes, error conditions, and relationship to the browser instance lifecycle, leaving too much undefined for reliable agent use.

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%, providing complete parameter documentation. The description adds no additional parameter semantics beyond implying a 'click' action, which aligns with but doesn't enhance the schema. This meets the baseline for high schema coverage.

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 'Click on a page element' clearly states the action (click) and target (page element), which is specific and unambiguous. However, it doesn't differentiate from potential sibling actions like 'right-click' or 'double-click' that might be implied by parameters but aren't explicitly mentioned in the description itself.

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?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites (e.g., needing an active browser instance), when not to use it, or how it relates to sibling tools like browser_wait_for_element or browser_select_option for similar interactive scenarios.

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/sailaoda/concurrent-browser-mcp'

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