@genart-dev/mcp-server 0.4.5 → 0.4.7

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 CHANGED
@@ -2891,9 +2891,7 @@ async function captureScreenshot(state, input) {
2891
2891
  previewPath
2892
2892
  });
2893
2893
  const previewJpegBase64 = Buffer.from(multi.inlineJpeg).toString("base64");
2894
- const previewDataUri = `data:image/jpeg;base64,${previewJpegBase64}`;
2895
- metadata.previewDataUri = previewDataUri;
2896
- return { metadata, previewJpegBase64, previewDataUri };
2894
+ return { metadata, previewJpegBase64 };
2897
2895
  } catch (e) {
2898
2896
  const msg = e instanceof Error ? e.message : String(e);
2899
2897
  throw new Error(`Renderer error for '${sketchId}': ${msg}`);
@@ -5491,7 +5489,7 @@ function registerSketchTools(server, state) {
5491
5489
  addToWorkspace: import_zod2.z.string().optional().describe("Path to workspace to add sketch to after creation"),
5492
5490
  agent: import_zod2.z.string().optional().describe("Your CLI agent name (e.g. 'claude-code', 'codex-cli', 'gemini-cli', 'opencode', 'kiro')"),
5493
5491
  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
+ 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
5493
  },
5496
5494
  async (args) => {
5497
5495
  try {
@@ -5504,11 +5502,11 @@ function registerSketchTools(server, state) {
5504
5502
  });
5505
5503
  return {
5506
5504
  content: [
5505
+ { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5507
5506
  { type: "text", text: JSON.stringify({
5508
5507
  ...result,
5509
5508
  capture: captureResult.metadata
5510
- }, null, 2) },
5511
- { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" }
5509
+ }, null, 2) }
5512
5510
  ]
5513
5511
  };
5514
5512
  } catch (captureErr) {
@@ -6074,7 +6072,7 @@ function registerSnapshotTools(server, state) {
6074
6072
  function registerCaptureTools(server, state) {
6075
6073
  server.tool(
6076
6074
  "capture_screenshot",
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.",
6075
+ "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).",
6078
6076
  {
6079
6077
  target: import_zod2.z.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
6080
6078
  sketchId: import_zod2.z.string().optional().describe("Required when target is 'sketch'"),
@@ -6087,11 +6085,11 @@ function registerCaptureTools(server, state) {
6087
6085
  async (args) => {
6088
6086
  try {
6089
6087
  const result = await captureScreenshot(state, args);
6090
- console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}, metadata: ${JSON.stringify(result.metadata)}`);
6088
+ console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}`);
6091
6089
  return {
6092
6090
  content: [
6093
- { type: "text", text: JSON.stringify(result.metadata, null, 2) },
6094
- { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" }
6091
+ { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
6092
+ { type: "text", text: JSON.stringify(result.metadata, null, 2) }
6095
6093
  ]
6096
6094
  };
6097
6095
  } catch (e) {
@@ -6102,7 +6100,7 @@ function registerCaptureTools(server, state) {
6102
6100
  );
6103
6101
  server.tool(
6104
6102
  "capture_batch",
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.",
6103
+ "Capture screenshots of multiple sketches in parallel. Returns inline JPEG images + per-sketch metadata. In local mode, writes full-res PNGs to snapshots/.",
6106
6104
  {
6107
6105
  sketchIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("IDs of sketches to capture (default: all)"),
6108
6106
  width: import_zod2.z.number().optional().describe("Override width for all captures"),
@@ -6117,15 +6115,15 @@ function registerCaptureTools(server, state) {
6117
6115
  { type: "text", text: JSON.stringify(result.metadata, null, 2) }
6118
6116
  ];
6119
6117
  for (const item of result.items) {
6120
- content.push({
6121
- type: "text",
6122
- text: JSON.stringify(item.metadata, null, 2)
6123
- });
6124
6118
  content.push({
6125
6119
  type: "image",
6126
6120
  data: item.inlineJpegBase64,
6127
6121
  mimeType: "image/jpeg"
6128
6122
  });
6123
+ content.push({
6124
+ type: "text",
6125
+ text: JSON.stringify(item.metadata, null, 2)
6126
+ });
6129
6127
  }
6130
6128
  return { content };
6131
6129
  } catch (e) {