Skip to main content
Glama
cloudflare

Cloudflare Playwright MCP

Official
by cloudflare

browser_hover

Read-only

Simulate hovering over specific webpage elements using Playwright for precise interaction and testing in Cloudflare Workers environments.

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 implements the browser_hover tool logic: locates the target element from the page snapshot and performs a hover action on it.
      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, including name, title, description, input schema (elementSchema), and type.
    schema: {
      name: 'browser_hover',
      title: 'Hover mouse',
      description: 'Hover over element on page',
      inputSchema: elementSchema,
      type: 'readOnly',
    },
  • Shared Zod schema for element parameters (element description and ref), used as inputSchema for browser_hover and other 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'),
    });
  • The complete tool definition for browser_hover using defineTool, which registers the tool with its schema and handler.
    const hover = defineTool({
      capability: 'core',
      schema: {
        name: 'browser_hover',
        title: 'Hover mouse',
        description: 'Hover over element on page',
        inputSchema: elementSchema,
        type: 'readOnly',
      },
    
      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,
        };
      },
    });
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=true, indicating a safe, non-destructive operation with open-world assumptions. The description adds minimal behavioral context beyond this—it specifies the hover action but doesn't mention side effects (e.g., triggering UI changes), performance considerations, or error handling. With annotations covering safety, a 3 is appropriate as the description adds some value but not rich behavioral details.

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, direct sentence with zero wasted words—'Hover over element on page' efficiently conveys the core action and target. It's front-loaded and appropriately sized for a simple tool, with every word earning its place.

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 low complexity (simple interaction), rich annotations (safety profile covered), and no output schema, the description is minimally adequate. It states what the tool does but lacks context on integration with siblings (e.g., dependency on browser_snapshot) or expected outcomes. Completeness is borderline, as it relies heavily on structured fields without compensating for gaps.

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. Baseline 3 is correct when the schema fully documents parameters.

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 over') and target ('element on page'), making the purpose immediately understandable. It distinguishes itself from siblings like browser_click or browser_type by specifying the hover interaction. However, it doesn't explicitly mention the mouse aspect or differentiate from all possible siblings like browser_drag.

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 prerequisites (e.g., needing a page snapshot from browser_snapshot), typical use cases (e.g., triggering hover effects), or when to choose other interaction tools like browser_click. Usage is implied but not articulated.

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

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