Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

mouseClick

Simulate mouse clicks at precise screen coordinates to automate browser interactions for web testing and scraping tasks.

Instructions

Click at specific coordinates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYes
yYes

Implementation Reference

  • The main handler function in PlaywrightController that executes the mouse click at the given (x, y) coordinates using the Playwright mouse API.
    async mouseClick(x: number, y: number): Promise<void> { try { if (!this.isInitialized() || !this.state.page) { throw new Error('Browser not initialized'); } this.log('Clicking at coordinates', { x, y }); await this.state.page.mouse.click(x, y); this.currentMousePosition = { x, y }; this.log('Mouse click complete'); } catch (error: any) { console.error('Mouse click error:', error); throw new BrowserError('Failed to click at coordinates', 'Check if coordinates are valid'); } }
  • JSON Schema definition for the mouseClick tool, specifying required numeric x and y coordinates as input.
    const MOUSE_CLICK_TOOL: Tool = { name: "mouseClick", description: "Click at specific coordinates", inputSchema: { type: "object", properties: { x: { type: "number" }, y: { type: "number" } }, required: ["x", "y"] } };
  • src/server.ts:971-982 (registration)
    Registration in the MCP callTool request handler switch statement, which validates input and invokes the Playwright controller's mouseClick method.
    case 'mouseClick': { if (typeof args.x !== 'number' || typeof args.y !== 'number') { return { content: [{ type: "text", text: "X and Y coordinates are required" }], isError: true }; } await playwrightController.mouseClick(args.x, args.y); return { content: [{ type: "text", text: "Mouse clicked successfully" }] }; }
  • src/server.ts:550-550 (registration)
    Tool registration entry in the 'tools' dictionary passed to MCP Server capabilities for listTools and callTool discovery.
    mouseClick: MOUSE_CLICK_TOOL,

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