Skip to main content
Glama
VikashLoomba

MCP-Server-Playwright

browser_hover

Simulate mouse hover interactions on web page elements using CSS selectors to trigger dynamic content or reveal hidden UI components.

Instructions

Hover an element on the page using CSS selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for element to hover

Implementation Reference

  • Handler implementation for the 'browser_hover' tool. It hovers over the element specified by the CSS selector using Playwright's page.locator(). Includes error handling for strict mode violations by retrying on the first matching element.
    case ToolName.BrowserHover:
      try {
        await page.locator(args.selector).hover();
        return {
          content: [{
            type: "text",
              text: `Hovered ${args.selector}`,
            }],
          isError: false,
        };
      } catch (error) {
        if((error as Error).message.includes("strict mode violation")) {
            console.log("Strict mode violation, retrying on first element...");
            try {
                await page.locator(args.selector).first().hover();
                return {
                    content: [{
                        type: "text",
                        text: `Hovered ${args.selector}`,
                    }],
                    isError: false,
                };
            } catch (error) {
                return {
                    content: [{
                        type: "text",
                        text: `Failed to hover ${args.selector}: ${(error as Error).message}`,
                    }],
                    isError: true,
                };
            }
        }
        return {
          content: [{
            type: "text",
              text: `Failed to hover ${args.selector}: ${(error as Error).message}`,
            }],
          isError: true,
        };
      }
  • index.ts:119-129 (registration)
    Registration of the 'browser_hover' tool in the TOOLS array, including its name, description, and input schema requiring a 'selector' parameter.
    {
      name: ToolName.BrowserHover,
      description: "Hover an element on the page using CSS selector",
      inputSchema: {
        type: "object",
        properties: {
          selector: { type: "string", description: "CSS selector for element to hover" },
        },
        required: ["selector"],
      },
    },
  • Input schema definition for the 'browser_hover' tool, specifying the required 'selector' string parameter.
    inputSchema: {
      type: "object",
      properties: {
        selector: { type: "string", description: "CSS selector for element to hover" },
      },
      required: ["selector"],
    },
  • index.ts:30-33 (registration)
    Enum definition mapping ToolName.BrowserHover to the string 'browser_hover'.
      BrowserHover = "browser_hover",
      BrowserHoverText = "browser_hover_text",
      BrowserEvaluate = "browser_evaluate"
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action but doesn't explain what 'hover' means in this context (mouseover event simulation), whether it waits for element visibility, what happens if the selector matches multiple elements, or if there are any side effects. The description is minimal and lacks important behavioral context.

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 that communicates the core functionality without any wasted words. It's appropriately sized for a simple tool with one parameter and gets straight to the point.

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?

For a browser interaction tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the hover action accomplishes (triggering CSS :hover states, tooltips, etc.), what happens after hovering, or what errors might occur. Given the complexity of browser automation and lack of structured metadata, more context is needed.

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%, so the schema already fully documents the single 'selector' parameter. The description adds no additional parameter information beyond what's in the schema. This meets the baseline expectation when schema coverage is complete.

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 ('hover') and target ('an element on the page using CSS selector'), making the purpose immediately understandable. It doesn't explicitly distinguish from sibling tools like 'browser_hover_text', but the specificity of 'CSS selector' provides some implicit differentiation from text-based alternatives.

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 about when to use this tool versus alternatives like 'browser_hover_text' or 'browser_click'. The description only states what the tool does, not when it's appropriate or what prerequisites might be needed (e.g., page must be loaded, element must be visible).

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/VikashLoomba/MCP-Server-Playwright'

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