Skip to main content
Glama
Angeluis001

Playwright MCP

by Angeluis001

browser_hover

Destructive

Hover over web page elements to trigger interactive features like dropdown menus or tooltips during browser automation testing with Playwright MCP.

Instructions

Hover over element on page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementYesHuman-readable element description used to obtain permission to interact with the element
refYesExact target element reference from the page snapshot

Implementation Reference

  • The handler function that executes the browser_hover tool logic: hovers over the element using the locator from the page snapshot.
    handle: async (context, params) => {
      const snapshot = context.currentTabOrDie().snapshotOrDie();
      const locator = snapshot.refLocator(params);
    
      const code = [
        `// Hover over ${params.element}`,
        `await page.${await generateLocator(locator)}.hover();`
      ];
    
      return {
        code,
        action: () => locator.hover(),
        captureSnapshot: true,
        waitForNetwork: true,
      };
    },
  • Schema definition for the browser_hover tool, specifying name, title, description, inputSchema (elementSchema), and type.
    schema: {
      name: 'browser_hover',
      title: 'Hover mouse',
      description: 'Hover over element on page',
      inputSchema: elementSchema,
      type: 'readOnly',
    },
  • Zod schema for element input, used by browser_hover and other interaction tools.
    const elementSchema = z.object({
      element: z.string().describe('Human-readable element description used to obtain permission to interact with the element'),
      ref: z.string().describe('Exact target element reference from the page snapshot'),
    });
  • Local registration: hover tool included in the default export array from snapshot.ts
    export default [
      snapshot,
      click,
      drag,
      hover,
      type,
      selectOption,
    ];
  • src/tools.ts:35-50 (registration)
    Global registration: snapshotTools array includes ...snapshot (which exports browser_hover), used by the MCP server.
    export const snapshotTools: Tool<any>[] = [
      ...common(true),
      ...console,
      ...dialogs(true),
      ...files(true),
      ...install,
      ...keyboard(true),
      ...navigate(true),
      ...network,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs(true),
      ...testing,
      ...wait(true),
    ];

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.3/5.0
Behavior3/5

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

Annotations provide key behavioral hints: readOnlyHint=false, openWorldHint=true, and destructiveHint=true, indicating this is a mutable, open-world operation with potential destructive effects. The description adds minimal context beyond this, as 'Hover over element on page' doesn't disclose additional traits like what 'destructive' entails (e.g., unintended page changes) or any rate limits. It doesn't contradict annotations, but offers little extra insight, meeting the lower bar with annotations present.

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 'Hover over element on page' is extremely concise and front-loaded, consisting of a single, direct sentence that immediately conveys the core action. There is no wasted language or unnecessary elaboration, making it efficient for quick understanding without sacrificing clarity.

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

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (interactive browser action with destructive potential), the description is minimal but adequate when combined with annotations and a well-documented schema. It lacks output schema or details on return values, but annotations cover safety and world hints. The description could be more complete by explaining hover effects or prerequisites, but it meets basic needs without being misleading.

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 clear descriptions for both parameters: 'element' as a human-readable description for permission and 'ref' as an exact target reference. The description adds no parameter-specific information beyond what the schema provides, such as examples or usage notes. Given the high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 'Hover over element on page' clearly states the action (hover) and target (element on page), making the purpose immediately understandable. It distinguishes itself from siblings like 'browser_click' or 'browser_type' by specifying a hover interaction rather than click or typing. However, it doesn't explicitly differentiate from other mouse-related tools like 'browser_drag' beyond the verb, which keeps it from a perfect score.

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. It doesn't mention scenarios where hovering is appropriate (e.g., to trigger dropdowns or tooltips) or when to avoid it (e.g., for direct interactions like clicking). With siblings like 'browser_click' and 'browser_drag' available, the lack of usage context leaves the agent to infer when this specific mouse action is needed.

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