Skip to main content
Glama
andytango
by andytango

hover

Simulate mouse hover interactions on web elements to trigger dynamic content like dropdown menus, tooltips, or hover effects for automated browser testing and interaction.

Instructions

Hover over an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for the element
timeoutNoTimeout in milliseconds
tabIdNoTab ID to operate on (uses active tab if not specified)

Implementation Reference

  • Zod schema for hover tool input: requires CSS selector, optional timeout (ms), optional tabId.
    export const hoverSchema = z.object({
      selector: selectorSchema,
      timeout: timeoutSchema,
      tabId: tabIdSchema,
    });
  • Registers the 'hover' MCP tool with server.tool(): description, input schema, and inline handler that waits for element by selector and calls element.hover() using Playwright.
    // Hover over element
    server.tool(
      'hover',
      'Hover over an element on the page',
      hoverSchema.shape,
      async ({ selector, timeout, tabId }) => {
        const pageResult = await getPageForOperation(tabId);
        if (!pageResult.success) {
          return handleResult(pageResult);
        }
    
        const page = pageResult.data;
        const timeoutMs = timeout ?? getDefaultTimeout();
    
        try {
          const element = await page.waitForSelector(selector, {
            timeout: timeoutMs,
          });
    
          if (!element) {
            return handleResult(err(selectorNotFound(selector)));
          }
    
          await element.hover();
    
          return handleResult(ok({ hovered: true, selector }));
        } catch (error) {
          if (error instanceof Error && error.message.includes('waiting for selector')) {
            return handleResult(err(selectorNotFound(selector)));
          }
          return handleResult(err(normalizeError(error)));
        }
      }
    );
  • src/server.ts:24-24 (registration)
    Invokes registerInteractionTools(server) within createServer() to register all interaction tools, including 'hover'.
    registerInteractionTools(server);
  • Inline handler function for hover tool: gets page, waits for selector, hovers element, handles errors appropriately.
    async ({ selector, timeout, tabId }) => {
      const pageResult = await getPageForOperation(tabId);
      if (!pageResult.success) {
        return handleResult(pageResult);
      }
    
      const page = pageResult.data;
      const timeoutMs = timeout ?? getDefaultTimeout();
    
      try {
        const element = await page.waitForSelector(selector, {
          timeout: timeoutMs,
        });
    
        if (!element) {
          return handleResult(err(selectorNotFound(selector)));
        }
    
        await element.hover();
    
        return handleResult(ok({ hovered: true, selector }));
      } catch (error) {
        if (error instanceof Error && error.message.includes('waiting for selector')) {
          return handleResult(err(selectorNotFound(selector)));
        }
        return handleResult(err(normalizeError(error)));
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action but lacks details on side effects (e.g., if it triggers events), error handling, or performance implications. This is a significant gap for a tool that interacts with web elements.

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, clear sentence with zero waste, front-loading the core action. It's appropriately sized for a simple tool, making it highly efficient and easy to understand.

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 tool's complexity (interacting with web elements) and lack of annotations and output schema, the description is incomplete. It doesn't cover what happens on hover (e.g., tooltips, state changes), success/failure indicators, or integration with sibling tools, leaving gaps for an AI agent.

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%, so the schema fully documents all parameters. The description adds no additional meaning beyond what's in the schema, such as examples or edge cases, resulting in the baseline score of 3.

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 ('an element on the page'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'mouse' or 'click', which might have overlapping functionality, so it doesn't reach the highest 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 offers no guidance on when to use this tool versus alternatives like 'mouse' or 'click' from the sibling list, nor does it mention any prerequisites or exclusions. It's a basic statement of function without contextual usage advice.

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/andytango/puppeteer-mcp'

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