Skip to main content
Glama
Rainmen-xia

Chrome Debug MCP Server

by Rainmen-xia

click

Simulate mouse clicks at specific coordinates in a browser session. Integrates with Chrome Debug MCP Server to automate browser actions with persistent sessions.

Instructions

在指定坐标位置点击

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coordinateYes点击位置的坐标,格式为 'x,y'

Implementation Reference

  • Core handler function for the 'click' tool. Parses coordinate, performs mouse click using Puppeteer, handles network activity wait, wrapped in doAction for logging/screenshot.
    async click(coordinate: string): Promise<BrowserActionResult> { return this.doAction(async (page) => { await this.handleMouseInteraction(page, coordinate, async (x, y) => { await page.mouse.click(x, y); }); }); }
  • Helper function used by click (and hover) to parse coordinates, perform mouse action, monitor network requests, and wait for page stability after interaction.
    private async handleMouseInteraction( page: Page, coordinate: string, action: (x: number, y: number) => Promise<void>, ): Promise<void> { const [x, y] = coordinate.split(",").map(Number); // 设置网络请求监控 let hasNetworkActivity = false; const requestListener = () => { hasNetworkActivity = true; }; page.on("request", requestListener); // 执行鼠标操作 await action(x, y); this.currentMousePosition = coordinate; // 小延迟检查操作是否触发了任何网络活动 await delay(100); if (hasNetworkActivity) { // 如果检测到网络活动,等待导航/加载 await page .waitForNavigation({ waitUntil: ["domcontentloaded", "networkidle2"], timeout: 15000, }) .catch(async () => { // 如果networkidle2失败,尝试仅等待domcontentloaded console.log("鼠标交互后网络静默等待失败,尝试仅等待DOM"); await page.waitForNavigation({ waitUntil: ["domcontentloaded"], timeout: 15000, }).catch(() => { // 如果还是失败,就忽略,继续执行 console.log("鼠标交互后导航等待失败,继续执行"); }); }); await this.waitTillHTMLStable(page); } // 清理监听器 page.off("request", requestListener); }
  • src/index.ts:82-95 (registration)
    Tool registration in the MCP listTools response, defining name, description, and input schema for 'click'.
    { name: "click", description: "在指定坐标位置点击", inputSchema: { type: "object", properties: { coordinate: { type: "string", description: "点击位置的坐标,格式为 'x,y'", }, }, required: ["coordinate"], }, },
  • Input schema definition for the 'click' tool, specifying required 'coordinate' parameter as string in 'x,y' format.
    inputSchema: { type: "object", properties: { coordinate: { type: "string", description: "点击位置的坐标,格式为 'x,y'", }, }, required: ["coordinate"], },
  • MCP CallTool dispatch handler for 'click': validates input and delegates to browserSession.click.
    case "click": if (!args?.coordinate) { throw new Error("coordinate参数是必需的"); } result = await this.browserSession.click(args.coordinate as string); break;

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/Rainmen-xia/chrome-debug-mcp'

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