Skip to main content
Glama

browser_hover_text

Hover over webpage elements by text content to identify interactive components during security testing for vulnerability detection.

Instructions

Hover an element on the page by its text content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText content of the element to hover

Implementation Reference

  • The main handler logic for the 'browser_hover_text' tool. It uses Playwright's page.getByText to locate an element by text and calls hover() on it, with comprehensive error handling including retry for strict mode violations.
    case ToolName.BrowserHoverText:
      try {
        await page.getByText(args.text).hover();
        return {
          content: [{
            type: "text",
            text: `Hovered element with text: ${args.text}`,
          }],
          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.getByText(args.text).first().hover();
                return {
                    content: [{
                        type: "text",
                        text: `Hovered element with text: ${args.text}`,
                    }],
                    isError: false,
                };
            } catch (error) {
                return {
                    content: [{
                        type: "text",
                        text: `Failed (twice) to hover element with text ${args.text}: ${(error as Error).message}`,
                    }],
                    isError: true,
                };
            }
        }
        return {
          content: [{
            type: "text",
            text: `Failed to hover element with text ${args.text}: ${(error as Error).message}`,
          }],
          isError: true,
        };
      }
  • index.ts:144-154 (registration)
    Registration of the 'browser_hover_text' tool in the TOOLS array, including its name (ToolName.BrowserHoverText), description, and input schema definition. This array is used by the ListToolsRequestSchema handler.
    {
      name: ToolName.BrowserHoverText,
      description: "Hover an element on the page by its text content",
      inputSchema: {
        type: "object",
        properties: {
          text: { type: "string", description: "Text content of the element to hover" },
        },
        required: ["text"],
      },
    },
  • Input schema for the 'browser_hover_text' tool, defining a required 'text' string parameter.
    inputSchema: {
      type: "object",
      properties: {
        text: { type: "string", description: "Text content of the element to hover" },
      },
      required: ["text"],
    },
  • Enum constant defining the tool name string 'browser_hover_text' used throughout the code.
    BrowserHoverText = "browser_hover_text",

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.3/5.0
Behavior2/5

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

No annotations exist, and the description fails to disclose behavioral traits such as visibility requirements, scrolling behavior, hover duration, or event simulation. The description carries minimal behavioral context.

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?

A single, front-loaded sentence efficiently conveys the tool's purpose without unnecessary words or repetition.

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?

For a simple one-parameter tool, the description is adequate but lacks context on behavior (e.g., scrolling, visible requirement) and does not help differentiate from sibling tools, leaving gaps for complex usage.

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 coverage is 100% with one parameter described as 'Text content of the element to hover'. The description adds no additional meaning beyond the schema, meeting baseline but not exceeding it.

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?

The description 'Hover an element on the page by its text content' clearly states the action (hover) and resource (element) and specifies the method (by text content), distinguishing it from sibling like 'browser_hover' which likely uses selectors.

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' (by selector) or 'browser_click_text'. No mention of prerequisites, limitations, or exclusions.

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