Skip to main content
Glama

browser_hover

Hover over webpage elements using CSS selectors to test interactive components and identify potential security vulnerabilities during penetration testing.

Instructions

Hover an element on the page using CSS selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for element to hover

Implementation Reference

  • Handler implementation for 'browser_hover' tool: hovers over the page element matching the given CSS selector using Playwright's locator.hover(), with error handling and retry for strict mode violations.
    case ToolName.BrowserHover:
      try {
        await page.locator(args.selector).hover();
        return {
          content: [{
            type: "text",
              text: `Hovered ${args.selector}`,
            }],
          isError: false,
        };
      } catch (error) {
        if((error as Error).message.includes("strict mode violation")) {
            console.log("Strict mode violation, retrying on first element...");
            try {
                await page.locator(args.selector).first().hover();
                return {
                    content: [{
                        type: "text",
                        text: `Hovered ${args.selector}`,
                    }],
                    isError: false,
                };
            } catch (error) {
                return {
                    content: [{
                        type: "text",
                        text: `Failed to hover ${args.selector}: ${(error as Error).message}`,
                    }],
                    isError: true,
                };
            }
        }
        return {
          content: [{
            type: "text",
              text: `Failed to hover ${args.selector}: ${(error as Error).message}`,
            }],
          isError: true,
        };
      }
  • Input schema for 'browser_hover' tool, defining the required 'selector' parameter as a CSS selector string.
    {
      name: ToolName.BrowserHover,
      description: "Hover an element on the page using CSS selector",
      inputSchema: {
        type: "object",
        properties: {
          selector: { type: "string", description: "CSS selector for element to hover" },
        },
        required: ["selector"],
      },
    },
  • index.ts:840-842 (registration)
    Registration of the tool list handler, exposing 'browser_hover' (via TOOLS array) through ListToolsRequestSchema.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: TOOLS,
    }));
  • index.ts:844-846 (registration)
    Registration of the CallToolRequestSchema handler, which routes calls to the specific tool handler based on name.
    server.setRequestHandler(CallToolRequestSchema, async (request) =>
      handleToolCall(request.params.name as ToolName, request.params.arguments ?? {})
    );
  • Enum definition mapping 'browser_hover' string to ToolName.BrowserHover constant used throughout the code.
    enum ToolName {
      BrowserNavigate = "browser_navigate",
      BrowserScreenshot = "browser_screenshot",
      BrowserClick = "browser_click",
      BrowserClickText = "browser_click_text",
      BrowserFill = "browser_fill",
      BrowserSelect = "browser_select",
      BrowserSelectText = "browser_select_text",
      BrowserHover = "browser_hover",
      BrowserHoverText = "browser_hover_text",
      BrowserEvaluate = "browser_evaluate",
      BrowserUrlReflectedXss = "broser_url_reflected_xss",
      BrowserUrlSqlInjection = "browser_url_sql_injection"
    }
Behavior2/5

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

With no annotations, the description carries full burden but only states the basic action. It doesn't disclose behavioral traits like whether hovering triggers events, if it waits for element visibility, error handling for invalid selectors, or side effects like page changes. This leaves gaps in understanding the tool's operation.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized for a simple tool, with zero waste.

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 (a browser interaction with no annotations or output schema), the description is incomplete. It lacks details on behavior, error cases, and how it integrates with sibling tools, making it insufficient for an agent to use it effectively without additional 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?

The schema description coverage is 100%, with the parameter 'selector' fully documented in the schema. The description adds minimal value by mentioning 'CSS selector' but doesn't provide additional semantics beyond what the schema already specifies, such as selector syntax examples or constraints.

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') and target ('element on the page'), specifying the method ('using CSS selector'). It distinguishes from some siblings like 'browser_click' but not from 'browser_hover_text', which suggests similar functionality with a different targeting method.

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?

No guidance is provided on when to use this tool versus alternatives like 'browser_hover_text' or 'browser_click'. The description implies usage for hovering but lacks context on prerequisites, such as requiring a loaded page or element visibility.

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/9olidity/MCP-Server-Pentest'

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