@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.js CHANGED
@@ -2574,9 +2574,7 @@ async function captureScreenshot(state, input) {
2574
2574
  previewPath
2575
2575
  });
2576
2576
  const previewJpegBase64 = Buffer.from(multi.inlineJpeg).toString("base64");
2577
- const previewDataUri = `data:image/jpeg;base64,${previewJpegBase64}`;
2578
- metadata.previewDataUri = previewDataUri;
2579
- return { metadata, previewJpegBase64, previewDataUri };
2577
+ return { metadata, previewJpegBase64 };
2580
2578
  } catch (e) {
2581
2579
  const msg = e instanceof Error ? e.message : String(e);
2582
2580
  throw new Error(`Renderer error for '${sketchId}': ${msg}`);
@@ -5187,7 +5185,7 @@ function registerSketchTools(server, state) {
5187
5185
  addToWorkspace: z2.string().optional().describe("Path to workspace to add sketch to after creation"),
5188
5186
  agent: z2.string().optional().describe("Your CLI agent name (e.g. 'claude-code', 'codex-cli', 'gemini-cli', 'opencode', 'kiro')"),
5189
5187
  model: z2.string().optional().describe("Your AI model identifier (e.g. 'claude-opus-4-6', 'gpt-4o', 'gemini-2.5-pro')"),
5190
- capture: z2.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.")
5188
+ capture: z2.boolean().optional().describe("When true, automatically capture a screenshot after creation and return it inline (avoids a separate capture_screenshot call)")
5191
5189
  },
5192
5190
  async (args) => {
5193
5191
  try {
@@ -5200,11 +5198,11 @@ function registerSketchTools(server, state) {
5200
5198
  });
5201
5199
  return {
5202
5200
  content: [
5201
+ { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5203
5202
  { type: "text", text: JSON.stringify({
5204
5203
  ...result,
5205
5204
  capture: captureResult.metadata
5206
- }, null, 2) },
5207
- { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" }
5205
+ }, null, 2) }
5208
5206
  ]
5209
5207
  };
5210
5208
  } catch (captureErr) {
@@ -5770,7 +5768,7 @@ function registerSnapshotTools(server, state) {
5770
5768
  function registerCaptureTools(server, state) {
5771
5769
  server.tool(
5772
5770
  "capture_screenshot",
5773
- "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.",
5771
+ "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).",
5774
5772
  {
5775
5773
  target: z2.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
5776
5774
  sketchId: z2.string().optional().describe("Required when target is 'sketch'"),
@@ -5783,11 +5781,11 @@ function registerCaptureTools(server, state) {
5783
5781
  async (args) => {
5784
5782
  try {
5785
5783
  const result = await captureScreenshot(state, args);
5786
- console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}, metadata: ${JSON.stringify(result.metadata)}`);
5784
+ console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}`);
5787
5785
  return {
5788
5786
  content: [
5789
- { type: "text", text: JSON.stringify(result.metadata, null, 2) },
5790
- { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" }
5787
+ { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
5788
+ { type: "text", text: JSON.stringify(result.metadata, null, 2) }
5791
5789
  ]
5792
5790
  };
5793
5791
  } catch (e) {
@@ -5798,7 +5796,7 @@ function registerCaptureTools(server, state) {
5798
5796
  );
5799
5797
  server.tool(
5800
5798
  "capture_batch",
5801
- "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.",
5799
+ "Capture screenshots of multiple sketches in parallel. Returns inline JPEG images + per-sketch metadata. In local mode, writes full-res PNGs to snapshots/.",
5802
5800
  {
5803
5801
  sketchIds: z2.array(z2.string()).optional().describe("IDs of sketches to capture (default: all)"),
5804
5802
  width: z2.number().optional().describe("Override width for all captures"),
@@ -5813,15 +5811,15 @@ function registerCaptureTools(server, state) {
5813
5811
  { type: "text", text: JSON.stringify(result.metadata, null, 2) }
5814
5812
  ];
5815
5813
  for (const item of result.items) {
5816
- content.push({
5817
- type: "text",
5818
- text: JSON.stringify(item.metadata, null, 2)
5819
- });
5820
5814
  content.push({
5821
5815
  type: "image",
5822
5816
  data: item.inlineJpegBase64,
5823
5817
  mimeType: "image/jpeg"
5824
5818
  });
5819
+ content.push({
5820
+ type: "text",
5821
+ text: JSON.stringify(item.metadata, null, 2)
5822
+ });
5825
5823
  }
5826
5824
  return { content };
5827
5825
  } catch (e) {