Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

mouseClick

Automate precise mouse clicks at designated screen coordinates using PlayMCP Browser Automation Server. Ideal for web testing, scraping, and interaction tasks.

Instructions

Click at specific coordinates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYes
yYes

Implementation Reference

  • Core implementation of the mouseClick tool: performs validation, logs the action, executes page.mouse.click(x, y), updates mouse position, and handles errors.
    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'); } }
  • Tool dispatch handler in callTool: validates input arguments and delegates to playwrightController.mouseClick.
    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" }] }; }
  • Defines the tool metadata including name, description, and input schema requiring x and y numbers.
    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:550-563 (registration)
    Registers the mouseClick tool in the tools object and passes it to the MCP Server capabilities.
    mouseClick: MOUSE_CLICK_TOOL, mouseDrag: MOUSE_DRAG_TOOL, closeBrowser: CLOSE_BROWSER_TOOL }; const server = new Server( { name: "playmcp-browser", version: "1.0.0", }, { capabilities: { 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/jomon003/PlayMCP'

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