Skip to main content
Glama

playwright_hover

Simulate mouse hover interactions on web elements using CSS selectors for automated testing or interaction workflows with browser automation.

Instructions

Hover an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for element to hover

Implementation Reference

  • The main handler logic for the 'playwright_hover' tool. It waits for the selector to appear and then hovers over the element using Playwright's page.hover method, returning success or error message.
    case "playwright_hover":
      try {
        await page!.waitForSelector(args.selector);
        await page!.hover(args.selector);
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `Hovered ${args.selector}`,
            }],
            isError: false,
          },
        };
      } catch (error) {
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `Failed to hover ${args.selector}: ${(error as Error).message}`,
            }],
            isError: true,
          },
        };
      }
  • The tool definition including name, description, and input schema for 'playwright_hover', used for registration and validation.
    {
      name: "playwright_hover",
      description: "Hover an element on the page",
      inputSchema: {
        type: "object",
        properties: {
          selector: { type: "string", description: "CSS selector for element to hover" },
        },
        required: ["selector"],
      },
    },
  • Registers the MCP 'list_tools' request handler, which returns the list of tool definitions including 'playwright_hover'.
    // List tools handler
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: tools,
    }));
  • Registers the MCP 'call_tool' request handler, which dispatches tool calls to handleToolCall where 'playwright_hover' is implemented.
    server.setRequestHandler(CallToolRequestSchema, async (request) =>
      handleToolCall(request.params.name, request.params.arguments ?? {}, server)
    );
  • Helper constant listing browser-requiring tools, including 'playwright_hover', used to conditionally launch the browser.
    export const BROWSER_TOOLS = [
      "playwright_navigate",
      "playwright_screenshot",
      "playwright_click",
      "playwright_fill",
      "playwright_select",
      "playwright_hover",
      "playwright_evaluate"
    ];
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 of behavioral disclosure. It states the action but doesn't describe what happens after hovering (e.g., whether it triggers events, waits for UI updates, or has side effects like opening menus). For a UI interaction tool with zero annotation coverage, this is a significant gap in transparency.

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. It's front-loaded with the core action and target, making it easy to parse quickly without unnecessary elaboration.

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 lack of annotations and output schema, the description is incomplete for a UI interaction tool. It doesn't explain the outcome of hovering (e.g., what the tool returns or any behavioral effects), leaving gaps in understanding how to use it effectively in workflows.

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 single parameter 'selector' clearly documented in the schema as 'CSS selector for element to hover'. The description doesn't add any meaning beyond this, such as selector best practices or examples, but the schema provides adequate baseline information.

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'), which is specific and unambiguous. It doesn't explicitly differentiate from siblings like playwright_click or playwright_select, but the verb 'hover' is distinct enough to imply a different interaction type.

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. With siblings like playwright_click, playwright_select, and playwright_fill available, there's no indication of when hovering is appropriate (e.g., for triggering dropdowns or tooltips) versus when other interactions are needed.

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

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

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