Skip to main content
Glama

playwright_click

Execute clicks on web page elements using a CSS selector. Enables browser automation for precise interactions within a real browser environment via Playwright.

Instructions

Click an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for the element to click

Implementation Reference

  • The ClickTool class implements the core execution logic for the 'playwright_click' tool by calling `page.click(args.selector)` within a safe execution wrapper.
    export class ClickTool extends BrowserToolBase {
      /**
       * Execute the click tool
       */
      async execute(args: any, context: ToolContext): Promise<ToolResponse> {
        return this.safeExecute(context, async (page) => {
          await page.click(args.selector);      
          return createSuccessResponse(`Clicked element: ${args.selector}`);
        });
      }
    }
  • Defines the input schema, name, and description for the 'playwright_click' tool.
    {
      name: "playwright_click",
      description: "Click an element on the page",
      inputSchema: {
        type: "object",
        properties: {
          selector: { type: "string", description: "CSS selector for the element to click" },
        },
        required: ["selector"],
      },
    },
  • Registers and dispatches 'playwright_click' tool calls to the ClickTool instance's execute method.
    case "playwright_click":
      return await clickTool.execute(args, context);
  • Instantiates the ClickTool instance used for handling 'playwright_click'.
    if (!clickTool) clickTool = new ClickTool(server);
  • Includes 'playwright_click' in the BROWSER_TOOLS array for conditional browser launching.
    "playwright_click",
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 lacks behavioral details. It doesn't disclose what 'click' entails (e.g., simulates user click, may trigger navigation or JavaScript events), error conditions (e.g., if selector not found), side effects, or performance considerations. The description is minimal and misses key operational context 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 a single, efficient sentence with zero waste—'Click an element on the page' directly conveys the core action without fluff. It's appropriately sized for a simple tool, though its brevity contributes to gaps in other dimensions like guidelines and transparency.

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 tool's complexity (a mutation action with potential side effects), lack of annotations, no output schema, and minimal description, it's incomplete. The description doesn't cover what happens after clicking (e.g., page changes, return values), error handling, or integration with sibling tools, leaving significant gaps for an AI agent to use it correctly.

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 parameter 'selector' fully documented in the schema as 'CSS selector for the element to click'. The description adds no additional meaning beyond this, such as selector syntax examples or constraints. Baseline score of 3 is appropriate since the schema handles parameter documentation adequately.

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 'Click an element on the page' clearly states the action (click) and target (element on page), but it's vague about scope and doesn't distinguish from siblings like 'playwright_click_and_switch_tab' or 'playwright_iframe_click'. It specifies 'on the page' but not whether this refers to the main page or includes iframes, leaving ambiguity compared to specialized sibling tools.

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., requires a page to be loaded), exclusions (e.g., not for iframes), or comparisons to siblings like 'playwright_click_and_switch_tab' for tab interactions or 'playwright_iframe_click' for iframe elements. Usage is implied but not explicitly stated.

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

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

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