Skip to main content
Glama
BrowserGenie

BrowserGenie MCP Server

by BrowserGenie

hover_element

Hover over elements to reveal dropdown menus, tooltips, and hover-only buttons or trigger CSS :hover states without clicking.

Instructions

Move mouse over an element without clicking. Use this to reveal dropdown menus, tooltips, hover-only buttons, or to trigger CSS :hover states.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYesElement or position to hover over
tabIdNoTarget tab ID (defaults to active tab)
apiKeyNoAPI key for authentication if enabled

Implementation Reference

  • The async handler function that sends the 'hover_element' command via the WebSocket bridge and returns the result.
      async ({ target, tabId, apiKey }) => {
        const result = await bridge.sendCommand({
          command: 'hover_element',
          params: { target },
          tabId,
          apiKey,
        });
        if (!result.success) {
          return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true };
        }
        return { content: [{ type: 'text', text: `Hovering over ${target.type === 'coordinates' ? `(${(target.value as any).x}, ${(target.value as any).y})` : target.value}` }] };
      }
    );
  • The 'targetSchema' Zod schema defining input validation for the target parameter (coordinates, css, or xpath).
    const targetSchema = z.object({
      type: z.enum(['coordinates', 'css', 'xpath']).describe('Method to locate: "css" (most reliable), "xpath", or "coordinates"'),
      value: z.union([
        z.string().describe('CSS selector or XPath to element'),
        z.object({ 
          x: z.number().describe('X coordinate in pixels'), 
          y: z.number().describe('Y coordinate in pixels') 
        }).describe('Exact pixel coordinates'),
      ]).describe('The selector string or {x, y} coordinates object'),
    });
  • The 'registerHoverTools' function that registers the 'hover_element' tool on the MCP server with its name, description, schema, and handler.
    export function registerHoverTools(server: McpServer, bridge: WebSocketBridge) {
      server.tool(
        'hover_element',
        'Move mouse over an element without clicking. Use this to reveal dropdown menus, tooltips, hover-only buttons, or to trigger CSS :hover states.',
        {
          target: targetSchema.describe('Element or position to hover over'),
          tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'),
          apiKey: z.string().optional().describe('API key for authentication if enabled'),
        },
        async ({ target, tabId, apiKey }) => {
          const result = await bridge.sendCommand({
            command: 'hover_element',
            params: { target },
            tabId,
            apiKey,
          });
          if (!result.success) {
            return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true };
          }
          return { content: [{ type: 'text', text: `Hovering over ${target.type === 'coordinates' ? `(${(target.value as any).x}, ${(target.value as any).y})` : target.value}` }] };
        }
      );
    }
  • The 'registerAllTools' function that calls registerHoverTools (indirect registration via index).
    export function registerAllTools(server: McpServer, bridge: WebSocketBridge) {
      registerNavigationTools(server, bridge);
      registerTabManagementTools(server, bridge);
      registerKeyboardTools(server, bridge);
      registerScreenshotTools(server, bridge);
      registerClickTools(server, bridge);
      registerInputTools(server, bridge);
      registerDragDropTools(server, bridge);
      registerHoverTools(server, bridge);
    
      registerDevtoolsSourcesTools(server, bridge);
      registerDevtoolsModifyTools(server, bridge);
      registerDevtoolsNetworkTools(server, bridge);
      registerDevtoolsStorageTools(server, bridge);
      registerDevtoolsConsoleTools(server, bridge);
    
      registerAccessibilityTools(server, bridge);
      registerEmulationTools(server, bridge);
      registerElementTools(server, bridge);
      registerAuditTools(server, bridge);
      registerInteractionTools(server, bridge);
      registerMonitoringTools(server, bridge);
      registerQaTools(server, bridge);
      registerGestureTools(server, bridge);
      registerMacroTools(server, bridge);
      registerVisualRegressionTools(server, bridge);
    }
  • The WebSocketBridge.sendCommand helper method that sends commands (including 'hover_element') to the browser extension.
    async sendCommand(cmd: BridgeCommand): Promise<BridgeResponse> {
      if (!this.isConnected()) {
        return {
          success: false,
          error: {
            code: 'NOT_CONNECTED',
            message: 'Chrome extension is not connected. Ensure the extension is installed, enabled, and the browser is running.',
          },
        };
      }
    
      const id = crypto.randomUUID();
      const timeout = cmd.timeout ?? DEFAULT_TIMEOUT;
    
      return new Promise<BridgeResponse>((resolve, reject) => {
        const timer = setTimeout(() => {
          this.pending.delete(id);
          resolve({
            success: false,
            error: {
              code: 'TIMEOUT',
              message: `Command '${cmd.command}' timed out after ${timeout}ms`,
            },
          });
        }, timeout);
    
        this.pending.set(id, { resolve, reject, timer });
    
        const message = {
          id,
          type: 'request',
          command: cmd.command,
          params: cmd.params,
          tabId: cmd.tabId,
          apiKey: cmd.apiKey,
          timestamp: Date.now(),
        };
    
        this.client!.send(JSON.stringify(message));
      });
    }
Behavior4/5

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

Since no annotations are provided, the description carries the full burden. It accurately describes the behavior as moving over without clicking and triggering CSS hover states. It could have mentioned that no mutation occurs, but overall clear.

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?

Two sentences, front-loaded with the action and followed by use cases. No redundant words. Excellent conciseness.

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

Completeness4/5

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

For a simple hover tool with no output schema, the description covers purpose, usage, and parameters adequately. Could mention return value or behavior upon failure, but not essential.

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 parameters are well-documented. The description adds the context of use cases but does not enhance parameter meaning beyond what's in the schema. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the action (move mouse over an element without clicking) and specific use cases (reveal dropdown menus, tooltips, hover-only buttons, trigger CSS :hover states). This distinguishes it well from sibling tools like click_element or double_tap.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit scenarios for when to use the tool (revealing menus, tooltips, etc.), giving clear context. However, it does not explicitly exclude cases or mention alternatives, which would have made it a 5.

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/BrowserGenie/mcp'

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