Skip to main content
Glama

hover_by_uid

Hover over webpage elements using unique identifiers from browser snapshots to inspect or interact with specific components during testing or automation.

Instructions

Hover over element by UID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesElement UID from snapshot

Implementation Reference

  • MCP tool handler: validates input, gets Firefox instance via getFirefox(), calls firefox.hoverByUid(uid), handles errors with UID-specific messages, returns success/error MCP response.
    export async function handleHoverByUid(args: unknown): Promise<McpToolResponse> { try { const { uid } = args as { uid: string }; if (!uid || typeof uid !== 'string') { throw new Error('uid parameter is required and must be a string'); } const { getFirefox } = await import('../index.js'); const firefox = await getFirefox(); try { await firefox.hoverByUid(uid); return successResponse(`✅ hover ${uid}`); } catch (error) { throw handleUidError(error as Error, uid); } } catch (error) { return errorResponse(error as Error); } }
  • Tool schema: defines name 'hover_by_uid', description, and inputSchema requiring 'uid' string from snapshot.
    export const hoverByUidTool = { name: 'hover_by_uid', description: 'Hover over element by UID.', inputSchema: { type: 'object', properties: { uid: { type: 'string', description: 'Element UID from snapshot', }, }, required: ['uid'], }, };
  • src/index.ts:132-132 (registration)
    Registers the handler function in the central toolHandlers Map for MCP server to route 'hover_by_uid' calls.
    ['hover_by_uid', tools.handleHoverByUid],
  • src/index.ts:176-176 (registration)
    Includes the tool schema in allTools array returned by listTools MCP request.
    tools.hoverByUidTool,
  • Core implementation: resolves UID to WebElement via snapshot callback, performs mouse hover using Selenium async actions, waits for event propagation.
    async hoverByUid(uid: string): Promise<void> { if (!this.resolveUid) { throw new Error('hoverByUid: resolveUid callback not set. Ensure snapshot is initialized.'); } const el = await this.resolveUid(uid); await this.driver.actions({ async: true }).move({ origin: el }).perform(); // Wait for events to propagate await this.waitForEventsAfterAction(); }

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/freema/firefox-devtools-mcp'

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