@genart-dev/mcp-server 0.4.4 → 0.4.6
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 +22 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/dist/lib.cjs +22 -7
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +22 -7
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2891,7 +2891,9 @@ async function captureScreenshot(state, input) {
|
|
|
2891
2891
|
previewPath
|
|
2892
2892
|
});
|
|
2893
2893
|
const previewJpegBase64 = Buffer.from(multi.inlineJpeg).toString("base64");
|
|
2894
|
-
|
|
2894
|
+
const previewDataUri = `data:image/jpeg;base64,${previewJpegBase64}`;
|
|
2895
|
+
metadata.previewDataUri = previewDataUri;
|
|
2896
|
+
return { metadata, previewJpegBase64, previewDataUri };
|
|
2895
2897
|
} catch (e) {
|
|
2896
2898
|
const msg = e instanceof Error ? e.message : String(e);
|
|
2897
2899
|
throw new Error(`Renderer error for '${sketchId}': ${msg}`);
|
|
@@ -5489,7 +5491,7 @@ function registerSketchTools(server, state) {
|
|
|
5489
5491
|
addToWorkspace: import_zod2.z.string().optional().describe("Path to workspace to add sketch to after creation"),
|
|
5490
5492
|
agent: import_zod2.z.string().optional().describe("Your CLI agent name (e.g. 'claude-code', 'codex-cli', 'gemini-cli', 'opencode', 'kiro')"),
|
|
5491
5493
|
model: import_zod2.z.string().optional().describe("Your AI model identifier (e.g. 'claude-opus-4-6', 'gpt-4o', 'gemini-2.5-pro')"),
|
|
5492
|
-
capture: import_zod2.z.boolean().optional().describe("When true, automatically capture a screenshot after creation
|
|
5494
|
+
capture: import_zod2.z.boolean().optional().describe("When true, automatically capture a screenshot after creation. The result includes previewDataUri for rendering. IMPORTANT: When capture is true, you MUST show the preview to the user by creating an HTML artifact with an <img> tag using the previewDataUri from the capture metadata. Include savedPreviewTo as caption for the full-res file.")
|
|
5493
5495
|
},
|
|
5494
5496
|
async (args) => {
|
|
5495
5497
|
try {
|
|
@@ -5500,10 +5502,15 @@ function registerSketchTools(server, state) {
|
|
|
5500
5502
|
target: "sketch",
|
|
5501
5503
|
sketchId: args.id
|
|
5502
5504
|
});
|
|
5505
|
+
const captureMeta = captureResult.metadata;
|
|
5503
5506
|
return {
|
|
5504
5507
|
content: [
|
|
5505
|
-
{ type: "text", text: JSON.stringify({
|
|
5506
|
-
|
|
5508
|
+
{ type: "text", text: JSON.stringify({
|
|
5509
|
+
...result,
|
|
5510
|
+
capture: captureMeta
|
|
5511
|
+
}, null, 2) },
|
|
5512
|
+
{ type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
|
|
5513
|
+
...captureMeta.savedPreviewTo ? [{ type: "text", text: `` }] : []
|
|
5507
5514
|
]
|
|
5508
5515
|
};
|
|
5509
5516
|
} catch (captureErr) {
|
|
@@ -6069,7 +6076,7 @@ function registerSnapshotTools(server, state) {
|
|
|
6069
6076
|
function registerCaptureTools(server, state) {
|
|
6070
6077
|
server.tool(
|
|
6071
6078
|
"capture_screenshot",
|
|
6072
|
-
"Capture a screenshot of a sketch. Returns metadata as text + a small inline JPEG image
|
|
6079
|
+
"Capture a screenshot of a sketch. Returns metadata (including previewDataUri) as text + a small inline JPEG image. In local mode, writes a full-res PNG to snapshots/<sketchId>-<seed>-preview.png. IMPORTANT: After every capture, you MUST show the preview to the user by creating an HTML artifact containing an <img> tag using the previewDataUri from the metadata. Include the savedPreviewTo path as a caption so the user can find the full-res file.",
|
|
6073
6080
|
{
|
|
6074
6081
|
target: import_zod2.z.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
|
|
6075
6082
|
sketchId: import_zod2.z.string().optional().describe("Required when target is 'sketch'"),
|
|
@@ -6086,7 +6093,9 @@ function registerCaptureTools(server, state) {
|
|
|
6086
6093
|
return {
|
|
6087
6094
|
content: [
|
|
6088
6095
|
{ type: "text", text: JSON.stringify(result.metadata, null, 2) },
|
|
6089
|
-
{ type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" }
|
|
6096
|
+
{ type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
|
|
6097
|
+
// Markdown image for hosts that render local file refs or data URIs
|
|
6098
|
+
...result.metadata.savedPreviewTo ? [{ type: "text", text: `` }] : []
|
|
6090
6099
|
]
|
|
6091
6100
|
};
|
|
6092
6101
|
} catch (e) {
|
|
@@ -6097,7 +6106,7 @@ function registerCaptureTools(server, state) {
|
|
|
6097
6106
|
);
|
|
6098
6107
|
server.tool(
|
|
6099
6108
|
"capture_batch",
|
|
6100
|
-
"Capture screenshots of multiple sketches in parallel. Returns metadata
|
|
6109
|
+
"Capture screenshots of multiple sketches in parallel. Returns per-sketch metadata (including previewDataUri) + inline JPEG images. IMPORTANT: After batch capture, you MUST show all previews to the user by creating an HTML artifact with <img> tags using each item's previewDataUri. Include sketch titles and savedPreviewTo paths.",
|
|
6101
6110
|
{
|
|
6102
6111
|
sketchIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("IDs of sketches to capture (default: all)"),
|
|
6103
6112
|
width: import_zod2.z.number().optional().describe("Override width for all captures"),
|
|
@@ -6121,6 +6130,12 @@ function registerCaptureTools(server, state) {
|
|
|
6121
6130
|
data: item.inlineJpegBase64,
|
|
6122
6131
|
mimeType: "image/jpeg"
|
|
6123
6132
|
});
|
|
6133
|
+
if (item.metadata.savedPreviewTo) {
|
|
6134
|
+
content.push({
|
|
6135
|
+
type: "text",
|
|
6136
|
+
text: ``
|
|
6137
|
+
});
|
|
6138
|
+
}
|
|
6124
6139
|
}
|
|
6125
6140
|
return { content };
|
|
6126
6141
|
} catch (e) {
|