@genart-dev/mcp-server 0.4.3 → 0.4.5
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 +29 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -4
- package/dist/index.js.map +1 -1
- package/dist/lib.cjs +29 -4
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +29 -4
- 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}`);
|
|
@@ -5488,11 +5490,34 @@ function registerSketchTools(server, state) {
|
|
|
5488
5490
|
).optional().describe('Component dependencies. Use list_components to see available. Keys are component names, values are semver ranges (e.g. "^1.0.0") or objects with version/code/exports.'),
|
|
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
|
-
model: import_zod2.z.string().optional().describe("Your AI model identifier (e.g. 'claude-opus-4-6', 'gpt-4o', 'gemini-2.5-pro')")
|
|
5493
|
+
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. 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.")
|
|
5492
5495
|
},
|
|
5493
5496
|
async (args) => {
|
|
5494
5497
|
try {
|
|
5495
5498
|
const result = await createSketch(state, args);
|
|
5499
|
+
if (args.capture && !state.remoteMode) {
|
|
5500
|
+
try {
|
|
5501
|
+
const captureResult = await captureScreenshot(state, {
|
|
5502
|
+
target: "sketch",
|
|
5503
|
+
sketchId: args.id
|
|
5504
|
+
});
|
|
5505
|
+
return {
|
|
5506
|
+
content: [
|
|
5507
|
+
{ type: "text", text: JSON.stringify({
|
|
5508
|
+
...result,
|
|
5509
|
+
capture: captureResult.metadata
|
|
5510
|
+
}, null, 2) },
|
|
5511
|
+
{ type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" }
|
|
5512
|
+
]
|
|
5513
|
+
};
|
|
5514
|
+
} catch (captureErr) {
|
|
5515
|
+
return jsonResult({
|
|
5516
|
+
...result,
|
|
5517
|
+
captureError: captureErr instanceof Error ? captureErr.message : String(captureErr)
|
|
5518
|
+
});
|
|
5519
|
+
}
|
|
5520
|
+
}
|
|
5496
5521
|
return jsonResult(result);
|
|
5497
5522
|
} catch (e) {
|
|
5498
5523
|
return toolError(e instanceof Error ? e.message : String(e));
|
|
@@ -6049,7 +6074,7 @@ function registerSnapshotTools(server, state) {
|
|
|
6049
6074
|
function registerCaptureTools(server, state) {
|
|
6050
6075
|
server.tool(
|
|
6051
6076
|
"capture_screenshot",
|
|
6052
|
-
"Capture a screenshot of a sketch. Returns metadata as text + a small inline JPEG image
|
|
6077
|
+
"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.",
|
|
6053
6078
|
{
|
|
6054
6079
|
target: import_zod2.z.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
|
|
6055
6080
|
sketchId: import_zod2.z.string().optional().describe("Required when target is 'sketch'"),
|
|
@@ -6077,7 +6102,7 @@ function registerCaptureTools(server, state) {
|
|
|
6077
6102
|
);
|
|
6078
6103
|
server.tool(
|
|
6079
6104
|
"capture_batch",
|
|
6080
|
-
"Capture screenshots of multiple sketches in parallel. Returns metadata
|
|
6105
|
+
"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.",
|
|
6081
6106
|
{
|
|
6082
6107
|
sketchIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("IDs of sketches to capture (default: all)"),
|
|
6083
6108
|
width: import_zod2.z.number().optional().describe("Override width for all captures"),
|