@genart-dev/mcp-server 0.4.6 → 0.4.8
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 +26 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/dist/lib.cjs +26 -26
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +26 -26
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2743,6 +2743,7 @@ function isDirectComponent(name, components) {
|
|
|
2743
2743
|
}
|
|
2744
2744
|
|
|
2745
2745
|
// src/tools/capture.ts
|
|
2746
|
+
var import_child_process = require("child_process");
|
|
2746
2747
|
var import_promises8 = require("fs/promises");
|
|
2747
2748
|
var import_path9 = require("path");
|
|
2748
2749
|
var import_core9 = require("@genart-dev/core");
|
|
@@ -2826,6 +2827,12 @@ async function captureHtmlMulti(options) {
|
|
|
2826
2827
|
|
|
2827
2828
|
// src/tools/capture.ts
|
|
2828
2829
|
var registry2 = (0, import_core9.createDefaultRegistry)();
|
|
2830
|
+
function openPreview(filePath) {
|
|
2831
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
2832
|
+
(0, import_child_process.exec)(`${cmd} "${filePath}"`, (err) => {
|
|
2833
|
+
if (err) console.error(`[openPreview] failed: ${err.message}`);
|
|
2834
|
+
});
|
|
2835
|
+
}
|
|
2829
2836
|
function applyOverrides(sketch, overrides) {
|
|
2830
2837
|
if (overrides.seed === void 0 && overrides.params === void 0) {
|
|
2831
2838
|
return sketch;
|
|
@@ -2891,9 +2898,7 @@ async function captureScreenshot(state, input) {
|
|
|
2891
2898
|
previewPath
|
|
2892
2899
|
});
|
|
2893
2900
|
const previewJpegBase64 = Buffer.from(multi.inlineJpeg).toString("base64");
|
|
2894
|
-
|
|
2895
|
-
metadata.previewDataUri = previewDataUri;
|
|
2896
|
-
return { metadata, previewJpegBase64, previewDataUri };
|
|
2901
|
+
return { metadata, previewJpegBase64 };
|
|
2897
2902
|
} catch (e) {
|
|
2898
2903
|
const msg = e instanceof Error ? e.message : String(e);
|
|
2899
2904
|
throw new Error(`Renderer error for '${sketchId}': ${msg}`);
|
|
@@ -2914,6 +2919,9 @@ async function buildScreenshotMetadata(state, multi, info) {
|
|
|
2914
2919
|
await (0, import_promises8.writeFile)(info.previewPath, multi.previewPng);
|
|
2915
2920
|
metadata.savedPreviewTo = info.previewPath;
|
|
2916
2921
|
metadata.previewWritten = true;
|
|
2922
|
+
if (info.autoOpen !== false) {
|
|
2923
|
+
openPreview(info.previewPath);
|
|
2924
|
+
}
|
|
2917
2925
|
}
|
|
2918
2926
|
return metadata;
|
|
2919
2927
|
}
|
|
@@ -2948,7 +2956,9 @@ async function captureBatch(state, input) {
|
|
|
2948
2956
|
target: "sketch",
|
|
2949
2957
|
sketchId: id,
|
|
2950
2958
|
seed: effectiveSeed,
|
|
2951
|
-
previewPath
|
|
2959
|
+
previewPath,
|
|
2960
|
+
autoOpen: false
|
|
2961
|
+
// Don't flood windows for batch captures
|
|
2952
2962
|
});
|
|
2953
2963
|
items.push({
|
|
2954
2964
|
metadata: itemMetadata,
|
|
@@ -5491,7 +5501,7 @@ function registerSketchTools(server, state) {
|
|
|
5491
5501
|
addToWorkspace: import_zod2.z.string().optional().describe("Path to workspace to add sketch to after creation"),
|
|
5492
5502
|
agent: import_zod2.z.string().optional().describe("Your CLI agent name (e.g. 'claude-code', 'codex-cli', 'gemini-cli', 'opencode', 'kiro')"),
|
|
5493
5503
|
model: import_zod2.z.string().optional().describe("Your AI model identifier (e.g. 'claude-opus-4-6', 'gpt-4o', 'gemini-2.5-pro')"),
|
|
5494
|
-
capture: import_zod2.z.boolean().optional().describe("When true, automatically capture a screenshot after creation
|
|
5504
|
+
capture: import_zod2.z.boolean().optional().describe("When true, automatically capture a screenshot after creation and return it inline (avoids a separate capture_screenshot call)")
|
|
5495
5505
|
},
|
|
5496
5506
|
async (args) => {
|
|
5497
5507
|
try {
|
|
@@ -5502,15 +5512,13 @@ function registerSketchTools(server, state) {
|
|
|
5502
5512
|
target: "sketch",
|
|
5503
5513
|
sketchId: args.id
|
|
5504
5514
|
});
|
|
5505
|
-
const captureMeta = captureResult.metadata;
|
|
5506
5515
|
return {
|
|
5507
5516
|
content: [
|
|
5517
|
+
{ type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
|
|
5508
5518
|
{ type: "text", text: JSON.stringify({
|
|
5509
5519
|
...result,
|
|
5510
|
-
capture:
|
|
5511
|
-
}, null, 2) }
|
|
5512
|
-
{ type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
|
|
5513
|
-
...captureMeta.savedPreviewTo ? [{ type: "text", text: `` }] : []
|
|
5520
|
+
capture: captureResult.metadata
|
|
5521
|
+
}, null, 2) }
|
|
5514
5522
|
]
|
|
5515
5523
|
};
|
|
5516
5524
|
} catch (captureErr) {
|
|
@@ -6076,7 +6084,7 @@ function registerSnapshotTools(server, state) {
|
|
|
6076
6084
|
function registerCaptureTools(server, state) {
|
|
6077
6085
|
server.tool(
|
|
6078
6086
|
"capture_screenshot",
|
|
6079
|
-
"Capture a screenshot of a sketch. Returns
|
|
6087
|
+
"Capture a screenshot of a sketch. Returns an inline JPEG image + metadata as text. In local mode, also writes a full-res PNG to snapshots/<sketchId>-<seed>-preview.png (path in savedPreviewTo).",
|
|
6080
6088
|
{
|
|
6081
6089
|
target: import_zod2.z.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
|
|
6082
6090
|
sketchId: import_zod2.z.string().optional().describe("Required when target is 'sketch'"),
|
|
@@ -6089,13 +6097,11 @@ function registerCaptureTools(server, state) {
|
|
|
6089
6097
|
async (args) => {
|
|
6090
6098
|
try {
|
|
6091
6099
|
const result = await captureScreenshot(state, args);
|
|
6092
|
-
console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}
|
|
6100
|
+
console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}`);
|
|
6093
6101
|
return {
|
|
6094
6102
|
content: [
|
|
6095
|
-
{ type: "text", text: JSON.stringify(result.metadata, null, 2) },
|
|
6096
6103
|
{ type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
|
|
6097
|
-
|
|
6098
|
-
...result.metadata.savedPreviewTo ? [{ type: "text", text: `` }] : []
|
|
6104
|
+
{ type: "text", text: JSON.stringify(result.metadata, null, 2) }
|
|
6099
6105
|
]
|
|
6100
6106
|
};
|
|
6101
6107
|
} catch (e) {
|
|
@@ -6106,7 +6112,7 @@ function registerCaptureTools(server, state) {
|
|
|
6106
6112
|
);
|
|
6107
6113
|
server.tool(
|
|
6108
6114
|
"capture_batch",
|
|
6109
|
-
"Capture screenshots of multiple sketches in parallel. Returns
|
|
6115
|
+
"Capture screenshots of multiple sketches in parallel. Returns inline JPEG images + per-sketch metadata. In local mode, writes full-res PNGs to snapshots/.",
|
|
6110
6116
|
{
|
|
6111
6117
|
sketchIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("IDs of sketches to capture (default: all)"),
|
|
6112
6118
|
width: import_zod2.z.number().optional().describe("Override width for all captures"),
|
|
@@ -6121,21 +6127,15 @@ function registerCaptureTools(server, state) {
|
|
|
6121
6127
|
{ type: "text", text: JSON.stringify(result.metadata, null, 2) }
|
|
6122
6128
|
];
|
|
6123
6129
|
for (const item of result.items) {
|
|
6124
|
-
content.push({
|
|
6125
|
-
type: "text",
|
|
6126
|
-
text: JSON.stringify(item.metadata, null, 2)
|
|
6127
|
-
});
|
|
6128
6130
|
content.push({
|
|
6129
6131
|
type: "image",
|
|
6130
6132
|
data: item.inlineJpegBase64,
|
|
6131
6133
|
mimeType: "image/jpeg"
|
|
6132
6134
|
});
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
});
|
|
6138
|
-
}
|
|
6135
|
+
content.push({
|
|
6136
|
+
type: "text",
|
|
6137
|
+
text: JSON.stringify(item.metadata, null, 2)
|
|
6138
|
+
});
|
|
6139
6139
|
}
|
|
6140
6140
|
return { content };
|
|
6141
6141
|
} catch (e) {
|