Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

click

Automate web interactions by clicking elements using CSS selectors for browser automation tasks like testing and data extraction.

Instructions

Click an element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYes

Implementation Reference

  • The core handler function implementing the click tool logic using Playwright's page.click for the given selector.
    async click(selector?: string): Promise<void> {
      try {
        if (!this.isInitialized() || !this.state.page) {
          throw new Error('Browser not initialized');
        }
        if (selector) {
          this.log('Clicking element', selector);
          await this.state.page.click(selector);
        } else {
          this.log('Clicking at position', this.currentMousePosition);
          await this.state.page.mouse.click(this.currentMousePosition.x, this.currentMousePosition.y);
        }
        this.log('Click complete');
      } catch (error: any) {
        console.error('Click error:', error);
        throw new BrowserError(
          'Failed to click',
          selector ? 'Check if the element exists and is visible' : 'Check if mouse position is valid'
        );
      }
    }
  • Schema definition for the 'click' tool, specifying name, description, and required 'selector' input.
    const CLICK_TOOL: Tool = {
      name: "click",
      description: "Click an element",
      inputSchema: {
        type: "object",
        properties: {
          selector: { type: "string" }
        },
        required: ["selector"]
      }
    };
  • MCP callTool handler case for 'click' that validates the selector argument and invokes the Playwright controller.
    case 'click': {
      if (!args.selector) {
        return {
          content: [{ type: "text", text: "Selector is required" }],
          isError: true
        };
      }
      await playwrightController.click(args.selector as string);
      return {
        content: [{ type: "text", text: "Click successful" }]
      };
    }
  • src/server.ts:555-565 (registration)
    Server initialization that registers the tools object (including 'click' tool) in MCP capabilities.
    const server = new Server(
      {
        name: "playmcp-browser",
        version: "1.0.0",
      },
      {
        capabilities: {
          tools,
        },
      }
    );
  • src/server.ts:518-518 (registration)
    Specific registration of the 'click' tool in the tools dictionary used for MCP server capabilities.
    click: CLICK_TOOL,
Behavior1/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 of behavioral disclosure. 'Click an element' offers no information about what happens during the click (e.g., does it wait for the element to be visible, handle errors, trigger page changes, or require specific page states?). It lacks details on permissions, side effects, or response behavior, making it inadequate for a mutation tool with zero annotation coverage.

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 with just three words, 'Click an element', which is front-loaded and wastes no space. Every word contributes directly to the core action, making it efficient in terms of brevity, though this conciseness comes at the cost of completeness.

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

Completeness1/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 no annotations, 1 parameter at 0% coverage, and no output schema), the description is incomplete. It fails to address behavioral traits, parameter details, usage context, or output expectations. For a tool that likely interacts with a web page, this minimal description does not provide enough information for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one parameter ('selector') with 0% description coverage, and the tool description adds no information about it. There is no explanation of what 'selector' means (e.g., CSS selector, XPath), its format, or examples. With low schema coverage and no compensatory details in the description, parameter understanding is severely lacking.

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

Purpose2/5

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

The description 'Click an element' is a tautology that essentially restates the tool name 'click' with minimal elaboration. While it specifies the action (click) and target (an element), it doesn't distinguish this tool from sibling tools like 'mouseClick' or 'selectOption' that might perform similar interactions. The purpose is clear at a basic level but lacks specificity about what makes this tool unique.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/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. With multiple sibling tools involving clicks or interactions (e.g., 'mouseClick', 'selectOption', 'handleDialog'), there is no indication of context, prerequisites, or exclusions. This leaves the agent without direction on selecting the appropriate tool for a given scenario.

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/jomon003/PlayMCP'

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