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" ];

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