Skip to main content
Glama

browser_hover

Simulate mouse hover actions on web page elements using Playwright MCP. Specify the target element to interact with, enabling precise browser automation without visual models.

Instructions

Hover over element on page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementYesHuman-readable element description used to obtain permission to interact with the element
refYesExact target element reference from the page snapshot

Implementation Reference

  • The main handler function for the 'browser_hover' tool. It retrieves the page snapshot, creates a locator for the target element, generates code for hovering, and executes the hover action using Playwright.
    handle: async (context, params) => { const snapshot = context.currentTabOrDie().snapshotOrDie(); const locator = snapshot.refLocator(params); const code = [ `// Hover over ${params.element}`, `await page.${await generateLocator(locator)}.hover();` ]; return { code, action: () => locator.hover(), captureSnapshot: true, waitForNetwork: true, }; }, });
  • Schema definition for the 'browser_hover' tool, including name, title, description, input schema (elementSchema), and type.
    schema: { name: 'browser_hover', title: 'Hover mouse', description: 'Hover over element on page', inputSchema: elementSchema, type: 'readOnly', },
  • src/tools.ts:35-50 (registration)
    Registration of the 'browser_hover' tool by including the 'snapshot' module (which exports it) in the 'snapshotTools' array via spread operator.
    export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...wait(true), ];
  • src/tools.ts:26-26 (registration)
    Import of the snapshot module containing the 'browser_hover' tool definition.
    import snapshot from './tools/snapshot.js';
  • Shared 'elementSchema' used as inputSchema for 'browser_hover' and other interaction tools.
    const elementSchema = z.object({ element: z.string().describe('Human-readable element description used to obtain permission to interact with the element'), ref: z.string().describe('Exact target element reference from the page snapshot'), });

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/Angeluis001/playwright-mcp'

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