@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/lib.cjs
CHANGED
|
@@ -2592,7 +2592,9 @@ async function captureScreenshot(state, input) {
|
|
|
2592
2592
|
previewPath
|
|
2593
2593
|
});
|
|
2594
2594
|
const previewJpegBase64 = Buffer.from(multi.inlineJpeg).toString("base64");
|
|
2595
|
-
|
|
2595
|
+
const previewDataUri = `data:image/jpeg;base64,${previewJpegBase64}`;
|
|
2596
|
+
metadata.previewDataUri = previewDataUri;
|
|
2597
|
+
return { metadata, previewJpegBase64, previewDataUri };
|
|
2596
2598
|
} catch (e) {
|
|
2597
2599
|
const msg = e instanceof Error ? e.message : String(e);
|
|
2598
2600
|
throw new Error(`Renderer error for '${sketchId}': ${msg}`);
|
|
@@ -5190,7 +5192,7 @@ function registerSketchTools(server, state) {
|
|
|
5190
5192
|
addToWorkspace: import_zod2.z.string().optional().describe("Path to workspace to add sketch to after creation"),
|
|
5191
5193
|
agent: import_zod2.z.string().optional().describe("Your CLI agent name (e.g. 'claude-code', 'codex-cli', 'gemini-cli', 'opencode', 'kiro')"),
|
|
5192
5194
|
model: import_zod2.z.string().optional().describe("Your AI model identifier (e.g. 'claude-opus-4-6', 'gpt-4o', 'gemini-2.5-pro')"),
|
|
5193
|
-
capture: import_zod2.z.boolean().optional().describe("When true, automatically capture a screenshot after creation
|
|
5195
|
+
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.")
|
|
5194
5196
|
},
|
|
5195
5197
|
async (args) => {
|
|
5196
5198
|
try {
|
|
@@ -5201,10 +5203,15 @@ function registerSketchTools(server, state) {
|
|
|
5201
5203
|
target: "sketch",
|
|
5202
5204
|
sketchId: args.id
|
|
5203
5205
|
});
|
|
5206
|
+
const captureMeta = captureResult.metadata;
|
|
5204
5207
|
return {
|
|
5205
5208
|
content: [
|
|
5206
|
-
{ type: "text", text: JSON.stringify({
|
|
5207
|
-
|
|
5209
|
+
{ type: "text", text: JSON.stringify({
|
|
5210
|
+
...result,
|
|
5211
|
+
capture: captureMeta
|
|
5212
|
+
}, null, 2) },
|
|
5213
|
+
{ type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
|
|
5214
|
+
...captureMeta.savedPreviewTo ? [{ type: "text", text: `` }] : []
|
|
5208
5215
|
]
|
|
5209
5216
|
};
|
|
5210
5217
|
} catch (captureErr) {
|
|
@@ -5770,7 +5777,7 @@ function registerSnapshotTools(server, state) {
|
|
|
5770
5777
|
function registerCaptureTools(server, state) {
|
|
5771
5778
|
server.tool(
|
|
5772
5779
|
"capture_screenshot",
|
|
5773
|
-
"Capture a screenshot of a sketch. Returns metadata as text + a small inline JPEG image
|
|
5780
|
+
"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.",
|
|
5774
5781
|
{
|
|
5775
5782
|
target: import_zod2.z.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
|
|
5776
5783
|
sketchId: import_zod2.z.string().optional().describe("Required when target is 'sketch'"),
|
|
@@ -5787,7 +5794,9 @@ function registerCaptureTools(server, state) {
|
|
|
5787
5794
|
return {
|
|
5788
5795
|
content: [
|
|
5789
5796
|
{ type: "text", text: JSON.stringify(result.metadata, null, 2) },
|
|
5790
|
-
{ type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" }
|
|
5797
|
+
{ type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
|
|
5798
|
+
// Markdown image for hosts that render local file refs or data URIs
|
|
5799
|
+
...result.metadata.savedPreviewTo ? [{ type: "text", text: `` }] : []
|
|
5791
5800
|
]
|
|
5792
5801
|
};
|
|
5793
5802
|
} catch (e) {
|
|
@@ -5798,7 +5807,7 @@ function registerCaptureTools(server, state) {
|
|
|
5798
5807
|
);
|
|
5799
5808
|
server.tool(
|
|
5800
5809
|
"capture_batch",
|
|
5801
|
-
"Capture screenshots of multiple sketches in parallel. Returns metadata
|
|
5810
|
+
"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.",
|
|
5802
5811
|
{
|
|
5803
5812
|
sketchIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("IDs of sketches to capture (default: all)"),
|
|
5804
5813
|
width: import_zod2.z.number().optional().describe("Override width for all captures"),
|
|
@@ -5822,6 +5831,12 @@ function registerCaptureTools(server, state) {
|
|
|
5822
5831
|
data: item.inlineJpegBase64,
|
|
5823
5832
|
mimeType: "image/jpeg"
|
|
5824
5833
|
});
|
|
5834
|
+
if (item.metadata.savedPreviewTo) {
|
|
5835
|
+
content.push({
|
|
5836
|
+
type: "text",
|
|
5837
|
+
text: ``
|
|
5838
|
+
});
|
|
5839
|
+
}
|
|
5825
5840
|
}
|
|
5826
5841
|
return { content };
|
|
5827
5842
|
} catch (e) {
|