Skip to main content
Glama
lewisvoncken

Playwright MCP

by lewisvoncken

browser_hover

Destructive

Hover over elements on web pages to trigger interactive features like dropdown menus, tooltips, and hover effects during browser automation 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

  • Handler function that executes the browser_hover tool: resolves locator from snapshot, generates code snippet, and performs hover action via Playwright.
      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,
        };
      },
    });
  • Input/output schema definition for browser_hover tool, using shared elementSchema for element ref and description.
    schema: {
      name: 'browser_hover',
      title: 'Hover mouse',
      description: 'Hover over element on page',
      inputSchema: elementSchema,
      type: 'readOnly',
    },
  • Shared 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'),
    });
  • Registration of the hover tool in the default export array of snapshot-related tools.
    export default [
      snapshot,
      click,
      drag,
      hover,
      type,
      selectOption,
    ];
  • src/tools.ts:36-52 (registration)
    Central registration of snapshot tools array, which includes the browser_hover tool via spread of snapshot exports.
    export const snapshotTools: Tool<any>[] = [
      ...common(true),
      ...console,
      ...dialogs(true),
      ...files(true),
      ...install,
      ...keyboard(true),
      ...navigate(true),
      ...network,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs(true),
      ...testing,
      ...video,
      ...wait(true),
    ];
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.

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

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