Skip to main content
Glama
livoras

Better Playwright MCP

by livoras

browserHover

Simulate mouse hover actions on specific web elements using Playwright, enabling precise interactions and snapshot captures for testing and automation workflows.

Instructions

悬停在页面元素上

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageIdYes页面ID
refYes元素的xp引用值
waitForTimeoutNo操作后等待获取快照的延迟时间(毫秒,默认2000)

Implementation Reference

  • Full implementation of the browser_hover (browserHover) tool handler. It uses element ref to get locator and performs hover, generates code snippet for reproduction, and waits for completion.
    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();
            });
        },
    });
  • Zod schema for element input, used by browser_hover tool's inputSchema.
    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'),
    });
  • Exports the hover tool along with others for inclusion in the allTools list.
    export default [
        snapshot,
        click,
        drag,
        hover,
        selectOption,
    ];
  • lib/tools.js:46-46 (registration)
    Includes snapshot tools (containing browser_hover) in the aggregated allTools export used by MCP backend.
    ...snapshot,
  • defineTabTool wrapper used to define the browser_hover tool, adding tab context and modal state checks.
    export function defineTabTool(tool) {
        return {
            ...tool,
            handle: async (context, params, response) => {
                const tab = context.currentTabOrDie();
                const modalStates = tab.modalStates().map(state => state.type);
                if (tool.clearsModalState && !modalStates.includes(tool.clearsModalState))
                    response.addError(`Error: The tool "${tool.schema.name}" can only be used when there is related modal state present.\n` + tab.modalStatesMarkdown().join('\n'));
                else if (!tool.clearsModalState && modalStates.length)
                    response.addError(`Error: Tool "${tool.schema.name}" does not handle the modal state.\n` + tab.modalStatesMarkdown().join('\n'));
                else
                    return tool.handle(tab, params, response);
            },
        };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It states the action (hover) but doesn't describe what happens after hovering (e.g., whether it triggers UI changes, waits for effects, or captures snapshots), error conditions, or performance implications. The input schema's 'waitForTimeout' parameter suggests timing behavior, but the description doesn't explain this. For a browser interaction tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise—a single Chinese phrase—with zero wasted words. It's front-loaded and to the point, though this brevity comes at the cost of completeness. Every sentence (in this case, the single phrase) earns its place by directly stating the action, making it structurally efficient despite informational gaps.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a browser interaction tool with 3 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain the tool's behavior, return values (e.g., whether it provides feedback or snapshots), or how it fits into workflows with sibling tools. The lack of output schema means the description should ideally hint at results, but it doesn't. This is inadequate for guiding an AI agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with all parameters documented in the schema itself (pageId, ref, waitForTimeout). The description adds no additional meaning beyond what the schema provides—it doesn't clarify parameter relationships, usage examples, or edge cases. According to the scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter info in the description, which applies here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '悬停在页面元素上' (hover over a page element) is a tautology that essentially restates the tool name 'browserHover' in Chinese. It doesn't specify what resource is being hovered over (browser page element) or distinguish this from sibling tools like 'browserClick' or 'browserPressKey' that also interact with page elements. The purpose is clear at a basic level but lacks specificity and differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'browserClick' for clicking or 'waitForSelector' for waiting on elements, nor does it specify use cases like triggering hover effects, tooltips, or dropdown menus. There's no indication of prerequisites, timing considerations, or when this tool would be preferred over other interaction methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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

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