ornold-mcp 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +13 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2433,8 +2433,19 @@ ${result.snapshot || ""}`;
|
|
|
2433
2433
|
}
|
|
2434
2434
|
case "cdp_click_normalized_box": {
|
|
2435
2435
|
const exec = await getExecutor();
|
|
2436
|
-
const
|
|
2437
|
-
return { content:
|
|
2436
|
+
const box = params.box;
|
|
2437
|
+
if (!box || box.length !== 4) return { content: "Invalid box coordinates", isError: true };
|
|
2438
|
+
const browsers = params.browserIds ? void 0 : await exec.listBrowsers();
|
|
2439
|
+
const targetId = params.browserIds?.[0] || browsers?.[0]?.id;
|
|
2440
|
+
if (!targetId) return { content: "No browser connected", isError: true };
|
|
2441
|
+
const page = exec.getPage(targetId);
|
|
2442
|
+
if (!page) return { content: "Browser page not found", isError: true };
|
|
2443
|
+
const vpRaw = await page.evaluate("JSON.stringify({ w: window.innerWidth, h: window.innerHeight })");
|
|
2444
|
+
const vp = JSON.parse(vpRaw);
|
|
2445
|
+
const centerX = (box[0] + box[2]) / 2 * vp.w;
|
|
2446
|
+
const centerY = (box[1] + box[3]) / 2 * vp.h;
|
|
2447
|
+
await page.mouse.click(centerX, centerY);
|
|
2448
|
+
return { content: JSON.stringify({ clicked: true, x: Math.round(centerX), y: Math.round(centerY), viewport: vp }), isError: false };
|
|
2438
2449
|
}
|
|
2439
2450
|
case "cdp_setup_downloads": {
|
|
2440
2451
|
const exec = await getExecutor();
|