Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

hover

Simulate hovering over any webpage element using a CSS selector, enabling interaction testing and dynamic content inspection in the PlayMCP Browser Automation Server.

Instructions

Hover over an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYes

Implementation Reference

  • The main handler function that executes the hover action using Playwright's locator.hover() method on the given CSS selector.
    async hover(selector: string): Promise<void> { try { if (!this.isInitialized() || !this.state.page) { throw new Error('Browser not initialized'); } this.log('Hovering over element', { selector }); const locator = this.state.page.locator(selector); await locator.hover(); this.log('Hover complete'); } catch (error: any) { console.error('Hover error:', error); throw new BrowserError('Failed to hover over element', 'Check if the selector exists and is visible'); }
  • JSON schema defining the input parameters for the 'hover' tool: requires a 'selector' string.
    const HOVER_TOOL: Tool = { name: "hover", description: "Hover over an element on the page", inputSchema: { type: "object", properties: { selector: { type: "string" } }, required: ["selector"] } };
  • src/server.ts:536-536 (registration)
    Registration of the HOVER_TOOL object in the tools map provided to the MCP server's capabilities.
    hover: HOVER_TOOL,
  • src/server.ts:795-806 (registration)
    Dispatch logic in the 'callTool' handler that validates input and invokes the hover handler from playwrightController.
    case 'hover': { if (!args.selector) { return { content: [{ type: "text", text: "Selector is required" }], isError: true }; } await playwrightController.hover(args.selector as string); return { content: [{ type: "text", text: "Hover completed successfully" }] }; }

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/jomon003/PlayMCP'

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