Skip to main content
Glama

browser_hover

Simulate mouse hover actions on web page elements using CSS selectors for precise interaction during browser automation tasks with MCP integration.

Instructions

Hover over an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for element to hover over

Implementation Reference

  • The handler function that executes the browser_hover tool logic. It waits for the specified CSS selector to appear on the page, hovers over the element using Playwright's page.hover method, and returns a success message or an error if the operation fails.
    async function handleBrowserHover(page: Page, args: any): Promise<{ toolResult: CallToolResult }> {
      try {
        await page.waitForSelector(args.selector);
        await page.hover(args.selector);
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `Hovered over element: ${args.selector}`,
            }],
            isError: false,
          },
        };
      } catch (error) {
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `Hover failed on ${args.selector}: ${(error as Error).message}`,
            }],
            isError: true,
          },
        };
      }
    }
  • The tool schema definition including name, description, and inputSchema specifying the required 'selector' parameter as a string.
    {
      name: "browser_hover",
      description: "Hover over an element on the page",
      inputSchema: {
        type: "object",
        properties: {
          selector: { type: "string", description: "CSS selector for element to hover over" }
        },
        required: ["selector"]
      }
    },
  • The switch case in executeToolCall that registers and dispatches the browser_hover tool call to the handleBrowserHover handler.
    case "browser_hover":
      return await handleBrowserHover(activePage!, args);
  • The BROWSER_TOOLS array that lists browser_hover among browser tools, used to identify browser tools in the executor.
    export const BROWSER_TOOLS = [
      "browser_navigate",
      "browser_screenshot",
      "browser_click",
      "browser_fill",
      "browser_select",
      "browser_hover",
      "browser_evaluate",
      "browser_set_viewport"
    ];
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action without behavioral details. It doesn't disclose side effects (e.g., if hovering triggers events or changes state), error handling, or dependencies (e.g., requires an element to exist). This leaves significant gaps for a mutation-like browser interaction.

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, direct sentence with zero wasted words, front-loading the core action. It's appropriately sized for a simple tool with one parameter.

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?

For a browser interaction tool with no annotations and no output schema, the description is insufficient. It lacks context on behavior, side effects, or return values, leaving the agent with minimal guidance beyond the basic action and parameter.

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 the parameter 'selector' fully documented in the schema as 'CSS selector for element to hover over'. The description adds no additional parameter semantics beyond what the schema provides, meeting the baseline for high coverage.

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'), making the purpose immediately understandable. However, it doesn't differentiate from sibling browser tools like 'browser_click' or 'browser_select' beyond the basic verb difference.

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_click' or 'browser_select', nor any context about prerequisites (e.g., needing a page to be loaded first). The description only states what it does, not when to apply it.

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

Related 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/imprvhub/mcp-browser-agent'

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