Skip to main content
Glama

click

Click on web page elements using CSS selectors to automate browser interactions for testing or data extraction tasks.

Instructions

Click on an element by selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYes
page_idNo

Implementation Reference

  • The main handler logic for the 'click' tool, which retrieves the selector from arguments, gets the active page, clicks the element, and returns a confirmation message.
    elif name == "click":
        selector = arguments.get("selector")
        if not selector:
            raise ValueError("Selector is required")
            
        page = get_active_page(arguments.get("page_id"))
        await page.click(selector)
        return [types.TextContent(type="text", text=f"Clicked element at selector: {selector}")]
  • Registration of the 'click' tool in the list_tools() function, including name, description, and input schema definition.
    types.Tool(
        name="click",
        description="Click on an element by selector",
        inputSchema={
            "type": "object",
            "properties": {
                "selector": {"type": "string"},
                "page_id": {"type": "string"},
            },
            "required": ["selector"],
        },
    ),
  • Helper function used by the 'click' handler (and others) to retrieve the active Playwright Page instance based on the provided page_id or the current default.
    def get_active_page(page_id: Optional[str] = None) -> Page:
        """Get the active page based on page_id or current default."""
        global current_page_id
        
        if page_id is None:
            page_id = current_page_id
        
        if page_id not in pages:
            raise ValueError(f"Page not found: {page_id}")
        
        return pages[page_id]
Behavior1/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 doesn't disclose whether clicking might trigger navigation, require element visibility, have side effects like page reloads, or handle errors. This is 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 a single, efficient sentence with zero waste, front-loading the core action. It's appropriately sized for a simple tool, though brevity contributes to gaps in other dimensions.

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?

For a mutation tool with no annotations, 2 parameters at 0% schema coverage, and no output schema, the description is completely inadequate. It lacks essential context like behavioral traits, parameter meanings, and usage scenarios, failing to provide enough information for effective tool invocation.

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?

Schema description coverage is 0%, and the description adds no parameter semantics beyond the schema. It mentions 'selector' but doesn't explain what a selector is, its format, or the purpose of 'page_id'. With 2 parameters and no schema descriptions, this fails to compensate for the coverage gap.

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 an element by selector' clearly states the action (click) and target (element by selector), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'wait_for_selector' or 'get_text' which also involve selectors, missing explicit distinction.

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. It doesn't mention prerequisites (e.g., needing a page loaded), exclusions, or comparisons to sibling tools like 'type' or 'navigate', leaving the agent without context for selection.

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/misanthropic-ai/playwrite-mcp'

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