@genart-dev/mcp-server 0.4.0 → 0.4.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/index.cjs +4 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -15
- package/dist/index.js.map +1 -1
- package/dist/lib.cjs +4 -16
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +3 -15
- package/dist/lib.js.map +1 -1
- package/package.json +3 -11
package/dist/lib.js
CHANGED
|
@@ -2430,26 +2430,12 @@ import {
|
|
|
2430
2430
|
} from "@genart-dev/core";
|
|
2431
2431
|
|
|
2432
2432
|
// src/capture/headless.ts
|
|
2433
|
-
|
|
2434
|
-
async function loadPuppeteer() {
|
|
2435
|
-
if (!cachedModule) {
|
|
2436
|
-
try {
|
|
2437
|
-
const mod = await import("puppeteer");
|
|
2438
|
-
cachedModule = mod.default ?? mod;
|
|
2439
|
-
} catch {
|
|
2440
|
-
throw new Error(
|
|
2441
|
-
"Puppeteer is required for screenshot capture. Install it with: npm install puppeteer"
|
|
2442
|
-
);
|
|
2443
|
-
}
|
|
2444
|
-
}
|
|
2445
|
-
return cachedModule;
|
|
2446
|
-
}
|
|
2433
|
+
import puppeteer from "puppeteer";
|
|
2447
2434
|
var browserInstance = null;
|
|
2448
2435
|
async function getBrowser() {
|
|
2449
2436
|
if (browserInstance && browserInstance.connected) {
|
|
2450
2437
|
return browserInstance;
|
|
2451
2438
|
}
|
|
2452
|
-
const puppeteer = await loadPuppeteer();
|
|
2453
2439
|
browserInstance = await puppeteer.launch({
|
|
2454
2440
|
headless: true,
|
|
2455
2441
|
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH || void 0,
|
|
@@ -5760,6 +5746,7 @@ function registerCaptureTools(server, state) {
|
|
|
5760
5746
|
async (args) => {
|
|
5761
5747
|
try {
|
|
5762
5748
|
const result = await captureScreenshot(state, args);
|
|
5749
|
+
console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}, metadata: ${JSON.stringify(result.metadata)}`);
|
|
5763
5750
|
return {
|
|
5764
5751
|
content: [
|
|
5765
5752
|
{ type: "text", text: JSON.stringify(result.metadata, null, 2) },
|
|
@@ -5767,6 +5754,7 @@ function registerCaptureTools(server, state) {
|
|
|
5767
5754
|
]
|
|
5768
5755
|
};
|
|
5769
5756
|
} catch (e) {
|
|
5757
|
+
console.error(`[capture_screenshot] error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5770
5758
|
return toolError(e instanceof Error ? e.message : String(e));
|
|
5771
5759
|
}
|
|
5772
5760
|
}
|