Skip to main content
Glama

browser_hover

Hover over elements on web pages to trigger interactive behaviors like tooltips, dropdowns, or menu expansions for testing or automation purposes.

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 handler function for the 'browser_hover' tool. It resolves the element locator from the input parameters, adds the corresponding Playwright hover code to the response, sets the snapshot inclusion flag, and executes the hover action while waiting for completion.
    handle: async (tab, params, response) => { response.setIncludeSnapshot(); const locator = await tab.refLocator(params); response.addCode(`await page.${await generateLocator(locator)}.hover();`); await tab.waitForCompletion(async () => { await locator.hover(); }); },
  • Schema definition for the 'browser_hover' tool, specifying the name, title, description, input schema (using shared elementSchema), and readOnly type.
    schema: { name: 'browser_hover', title: 'Hover mouse', description: 'Hover over element on page', inputSchema: elementSchema, type: 'readOnly', },
  • The complete definition and registration of the 'browser_hover' tool using defineTabTool, which includes the schema and handler.
    const hover = defineTabTool({ capability: 'core', schema: { name: 'browser_hover', title: 'Hover mouse', description: 'Hover over element on page', inputSchema: elementSchema, type: 'readOnly', }, handle: async (tab, params, response) => { response.setIncludeSnapshot(); const locator = await tab.refLocator(params); response.addCode(`await page.${await generateLocator(locator)}.hover();`); await tab.waitForCompletion(async () => { await locator.hover(); }); }, });
  • Shared Zod schema for element input parameters (element description and ref), used as inputSchema for browser_hover and other tools.
    export 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'), });
  • Export of the tool modules, including the browser_hover tool (as 'hover'), for higher-level registration.
    export default [ snapshot, click, drag, hover, selectOption, ];

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

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