Skip to main content
Glama

browser_hover

Read-only

Hover over elements on web pages to trigger interactive behaviors like tooltips, dropdowns, or menu expansions for testing or automation purposes.

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 for the 'browser_hover' tool. It resolves the element locator from the input parameters, adds the corresponding Playwright hover code to the response, sets the snapshot inclusion flag, and executes the hover action while waiting for completion.
    handle: async (tab, params, response) => {
      response.setIncludeSnapshot();
    
      const locator = await tab.refLocator(params);
      response.addCode(`await page.${await generateLocator(locator)}.hover();`);
    
      await tab.waitForCompletion(async () => {
        await locator.hover();
      });
    },
  • Schema definition for the 'browser_hover' tool, specifying the name, title, description, input schema (using shared elementSchema), and readOnly type.
    schema: {
      name: 'browser_hover',
      title: 'Hover mouse',
      description: 'Hover over element on page',
      inputSchema: elementSchema,
      type: 'readOnly',
    },
  • The complete definition and registration of the 'browser_hover' tool using defineTabTool, which includes the schema and handler.
    const hover = defineTabTool({
      capability: 'core',
      schema: {
        name: 'browser_hover',
        title: 'Hover mouse',
        description: 'Hover over element on page',
        inputSchema: elementSchema,
        type: 'readOnly',
      },
    
      handle: async (tab, params, response) => {
        response.setIncludeSnapshot();
    
        const locator = await tab.refLocator(params);
        response.addCode(`await page.${await generateLocator(locator)}.hover();`);
    
        await tab.waitForCompletion(async () => {
          await locator.hover();
        });
      },
    });
  • Shared Zod schema for element input parameters (element description and ref), used as inputSchema for browser_hover and other tools.
    export 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'),
    });
  • Export of the tool modules, including the browser_hover tool (as 'hover'), for higher-level registration.
    export default [
      snapshot,
      click,
      drag,
      hover,
      selectOption,
    ];

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 already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=true, indicating a safe, non-destructive operation with potential for dynamic content. The description adds minimal behavioral context beyond this, as 'hover' implies a UI interaction but doesn't detail effects like triggering events or visual feedback. It doesn't contradict annotations, so it earns a baseline score for adding some value.

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 efficiently communicates the core action. Every word earns its place with no redundancy or unnecessary elaboration, making it easy to parse quickly.

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 UI action), rich annotations (readOnlyHint, openWorldHint), and no output schema, the description is minimally complete. It states what the tool does but lacks details on outcomes (e.g., what hovering achieves), error conditions, or integration with sibling tools. This leaves gaps for an agent to fully leverage the tool in context.

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 documentation for both parameters: 'element' as a human-readable description for permissions and 'ref' as an exact target reference. The description adds no additional parameter semantics beyond what the schema provides, such as examples or interaction details, so it meets the baseline for high schema coverage without enhancing understanding.

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 uses a specific verb+resource pattern, though it doesn't explicitly differentiate from sibling tools like browser_click or browser_press_key, which prevents 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., triggering dropdowns, tooltips) or when to avoid it, nor does it reference sibling tools like browser_click for different interactions. This lack of contextual usage information is a significant gap.

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