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",

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.5/5.0
Behavior2/5

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

With no annotations, the description must disclose behavioral traits but only states the action. It does not mention whether the tool waits for the element, scrolls into view, or what happens on errors (e.g., timeout, element not found). This leaves critical behavioral details unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no fluff, but it is under-specified and lacks detail. Conciseness is not achieved at the expense of informativeness.

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 no output schema and only one parameter, the description is incomplete. It does not explain return value, side effects, or behavior in edge cases, which is important for a simple action tool.

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?

Input schema coverage is 100% with a single required parameter 'selector' well-described in the schema. The description adds no additional meaning beyond the schema, meeting the baseline expectation for high coverage.

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 and resource, but it is essentially a restatement of the tool name 'playwright_click' and does not differentiate from sibling tools like playwright_hover or playwright_fill.

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 lacks context about prerequisites, such as requiring the page to be loaded or the element to be visible, which could be inferred but is not explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.