Skip to main content
Glama

browser_hover

Simulate hovering over a specific element on a web page using structured accessibility snapshots, enabling precise interaction without screenshots or vision 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

  • Handler function that executes the browser_hover tool. It retrieves the locator for the specified element from the page snapshot and performs a hover action, generating corresponding code and an action callback.
    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, specifying name, title, description, input schema (requiring element description and ref), and type as readOnly.
    schema: { name: 'browser_hover', title: 'Hover mouse', description: 'Hover over element on page', inputSchema: elementSchema, type: 'readOnly', },
  • The complete tool definition and registration using defineTool, which includes schema and handler for browser_hover.
    const hover = defineTool({ capability: 'core', schema: { name: 'browser_hover', title: 'Hover mouse', description: 'Hover over element on page', inputSchema: elementSchema, type: 'readOnly', }, 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, }; }, });
  • Shared Zod schema for element parameters used in browser_hover inputSchema.
    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/manishamishraacc/mcp'

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