@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/lib.cjs CHANGED
@@ -2592,9 +2592,7 @@ async function captureScreenshot(state, input) {
2592
2592
  previewPath
2593
2593
  });
2594
2594
  const previewJpegBase64 = Buffer.from(multi.inlineJpeg).toString("base64");
2595
- const previewDataUri = `data:image/jpeg;base64,${previewJpegBase64}`;
2596
- metadata.previewDataUri = previewDataUri;
2597
- return { metadata, previewJpegBase64, previewDataUri };
2595
+ return { metadata, previewJpegBase64 };
2598
2596
  } catch (e) {
2599
2597
  const msg = e instanceof Error ? e.message : String(e);
2600
2598
  throw new Error(`Renderer error for '${sketchId}': ${msg}`);
@@ -5192,7 +5190,7 @@ function registerSketchTools(server, state) {
5192
5190
  addToWorkspace: import_zod2.z.string().optional().describe("Path to workspace to add sketch to after creation"),
5193
5191
  agent: import_zod2.z.string().optional().describe("Your CLI agent name (e.g. 'claude-code', 'codex-cli', 'gemini-cli', 'opencode', 'kiro')"),
5194
5192
  model: import_zod2.z.string().optional().describe("Your AI model identifier (e.g. 'claude-opus-4-6', 'gpt-4o', 'gemini-2.5-pro')"),
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.")
5193
+ 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)")
5196
5194
  },
5197
5195
  async (args) => {
5198
5196
  try {
@@ -5205,11 +5203,11 @@ function registerSketchTools(server, state) {
5205
5203
  });
5206
5204
  return {
5207
5205
  content: [
5206
+ { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5208
5207
  { type: "text", text: JSON.stringify({
5209
5208
  ...result,
5210
5209
  capture: captureResult.metadata
5211
- }, null, 2) },
5212
- { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" }
5210
+ }, null, 2) }
5213
5211
  ]
5214
5212
  };
5215
5213
  } catch (captureErr) {
@@ -5775,7 +5773,7 @@ function registerSnapshotTools(server, state) {
5775
5773
  function registerCaptureTools(server, state) {
5776
5774
  server.tool(
5777
5775
  "capture_screenshot",
5778
- "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.",
5776
+ "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).",
5779
5777
  {
5780
5778
  target: import_zod2.z.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
5781
5779
  sketchId: import_zod2.z.string().optional().describe("Required when target is 'sketch'"),
@@ -5788,11 +5786,11 @@ function registerCaptureTools(server, state) {
5788
5786
  async (args) => {
5789
5787
  try {
5790
5788
  const result = await captureScreenshot(state, args);
5791
- console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}, metadata: ${JSON.stringify(result.metadata)}`);
5789
+ console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}`);
5792
5790
  return {
5793
5791
  content: [
5794
- { type: "text", text: JSON.stringify(result.metadata, null, 2) },
5795
- { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" }
5792
+ { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
5793
+ { type: "text", text: JSON.stringify(result.metadata, null, 2) }
5796
5794
  ]
5797
5795
  };
5798
5796
  } catch (e) {
@@ -5803,7 +5801,7 @@ function registerCaptureTools(server, state) {
5803
5801
  );
5804
5802
  server.tool(
5805
5803
  "capture_batch",
5806
- "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.",
5804
+ "Capture screenshots of multiple sketches in parallel. Returns inline JPEG images + per-sketch metadata. In local mode, writes full-res PNGs to snapshots/.",
5807
5805
  {
5808
5806
  sketchIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("IDs of sketches to capture (default: all)"),
5809
5807
  width: import_zod2.z.number().optional().describe("Override width for all captures"),
@@ -5818,15 +5816,15 @@ function registerCaptureTools(server, state) {
5818
5816
  { type: "text", text: JSON.stringify(result.metadata, null, 2) }
5819
5817
  ];
5820
5818
  for (const item of result.items) {
5821
- content.push({
5822
- type: "text",
5823
- text: JSON.stringify(item.metadata, null, 2)
5824
- });
5825
5819
  content.push({
5826
5820
  type: "image",
5827
5821
  data: item.inlineJpegBase64,
5828
5822
  mimeType: "image/jpeg"
5829
5823
  });
5824
+ content.push({
5825
+ type: "text",
5826
+ text: JSON.stringify(item.metadata, null, 2)
5827
+ });
5830
5828
  }
5831
5829
  return { content };
5832
5830
  } catch (e) {