Skip to main content
Glama

playwright_click

Click elements on web pages using CSS selectors for browser automation with Playwright.

Instructions

Click an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for the element to click

Implementation Reference

  • ClickTool class implements the core logic for the playwright_click tool, using Playwright's page.click method on the provided CSS selector.
    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}`);
        });
      }
    }
  • MCP tool definition including name, description, and input schema for playwright_click, requiring a 'selector' parameter.
      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"],
      },
    },
  • Instantiation of the ClickTool instance in initializeTools function.
    if (!clickTool) clickTool = new ClickTool(server);
  • Dispatch in handleToolCall switch statement that routes playwright_click calls to the ClickTool's execute method.
    case "playwright_click":
      return await clickTool.execute(args, context);
  • src/tools.ts:496-496 (registration)
    Inclusion of playwright_click in BROWSER_TOOLS array, ensuring browser context is prepared before execution.
    "playwright_click",
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the basic action but lacks critical behavioral details: it doesn't specify if the click waits for navigation, handles visibility/accessibility, requires the element to be interactable, or what happens on failure (e.g., timeout). For a UI automation tool with zero annotation coverage, this is a significant gap.

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 ('click') and immediately specifies the target, making it easy to parse. Every word earns its place.

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 UI automation (interactive, state-dependent) and lack of annotations or output schema, the description is incomplete. It doesn't cover behavioral nuances like waiting, error handling, or interaction constraints, which are essential for an agent to use this tool correctly in a dynamic environment.

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. The description adds no additional parameter semantics beyond implying the selector targets a clickable element, which is already inferred from the tool's purpose. 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 clearly states the action ('click') and target ('an element on the page'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'playwright_iframe_click' or 'playwright_click_and_switch_tab', which would require mentioning the scope (main page vs iframe) or additional behavior (tab switching).

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. It doesn't mention prerequisites (e.g., needing a page loaded), exclusions (e.g., not for iframes), or comparisons to siblings like 'playwright_iframe_click' for iframe elements or 'playwright_click_and_switch_tab' for tab interactions.

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

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