@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.js CHANGED
@@ -2893,9 +2893,7 @@ async function captureScreenshot(state, input) {
2893
2893
  previewPath
2894
2894
  });
2895
2895
  const previewJpegBase64 = Buffer.from(multi.inlineJpeg).toString("base64");
2896
- const previewDataUri = `data:image/jpeg;base64,${previewJpegBase64}`;
2897
- metadata.previewDataUri = previewDataUri;
2898
- return { metadata, previewJpegBase64, previewDataUri };
2896
+ return { metadata, previewJpegBase64 };
2899
2897
  } catch (e) {
2900
2898
  const msg = e instanceof Error ? e.message : String(e);
2901
2899
  throw new Error(`Renderer error for '${sketchId}': ${msg}`);
@@ -5506,7 +5504,7 @@ function registerSketchTools(server, state) {
5506
5504
  addToWorkspace: z2.string().optional().describe("Path to workspace to add sketch to after creation"),
5507
5505
  agent: z2.string().optional().describe("Your CLI agent name (e.g. 'claude-code', 'codex-cli', 'gemini-cli', 'opencode', 'kiro')"),
5508
5506
  model: z2.string().optional().describe("Your AI model identifier (e.g. 'claude-opus-4-6', 'gpt-4o', 'gemini-2.5-pro')"),
5509
- 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.")
5507
+ capture: z2.boolean().optional().describe("When true, automatically capture a screenshot after creation and return it inline (avoids a separate capture_screenshot call)")
5510
5508
  },
5511
5509
  async (args) => {
5512
5510
  try {
@@ -5519,11 +5517,11 @@ function registerSketchTools(server, state) {
5519
5517
  });
5520
5518
  return {
5521
5519
  content: [
5520
+ { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5522
5521
  { type: "text", text: JSON.stringify({
5523
5522
  ...result,
5524
5523
  capture: captureResult.metadata
5525
- }, null, 2) },
5526
- { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" }
5524
+ }, null, 2) }
5527
5525
  ]
5528
5526
  };
5529
5527
  } catch (captureErr) {
@@ -6089,7 +6087,7 @@ function registerSnapshotTools(server, state) {
6089
6087
  function registerCaptureTools(server, state) {
6090
6088
  server.tool(
6091
6089
  "capture_screenshot",
6092
- "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.",
6090
+ "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).",
6093
6091
  {
6094
6092
  target: z2.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
6095
6093
  sketchId: z2.string().optional().describe("Required when target is 'sketch'"),
@@ -6102,11 +6100,11 @@ function registerCaptureTools(server, state) {
6102
6100
  async (args) => {
6103
6101
  try {
6104
6102
  const result = await captureScreenshot(state, args);
6105
- console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}, metadata: ${JSON.stringify(result.metadata)}`);
6103
+ console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}`);
6106
6104
  return {
6107
6105
  content: [
6108
- { type: "text", text: JSON.stringify(result.metadata, null, 2) },
6109
- { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" }
6106
+ { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
6107
+ { type: "text", text: JSON.stringify(result.metadata, null, 2) }
6110
6108
  ]
6111
6109
  };
6112
6110
  } catch (e) {
@@ -6117,7 +6115,7 @@ function registerCaptureTools(server, state) {
6117
6115
  );
6118
6116
  server.tool(
6119
6117
  "capture_batch",
6120
- "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.",
6118
+ "Capture screenshots of multiple sketches in parallel. Returns inline JPEG images + per-sketch metadata. In local mode, writes full-res PNGs to snapshots/.",
6121
6119
  {
6122
6120
  sketchIds: z2.array(z2.string()).optional().describe("IDs of sketches to capture (default: all)"),
6123
6121
  width: z2.number().optional().describe("Override width for all captures"),
@@ -6132,15 +6130,15 @@ function registerCaptureTools(server, state) {
6132
6130
  { type: "text", text: JSON.stringify(result.metadata, null, 2) }
6133
6131
  ];
6134
6132
  for (const item of result.items) {
6135
- content.push({
6136
- type: "text",
6137
- text: JSON.stringify(item.metadata, null, 2)
6138
- });
6139
6133
  content.push({
6140
6134
  type: "image",
6141
6135
  data: item.inlineJpegBase64,
6142
6136
  mimeType: "image/jpeg"
6143
6137
  });
6138
+ content.push({
6139
+ type: "text",
6140
+ text: JSON.stringify(item.metadata, null, 2)
6141
+ });
6144
6142
  }
6145
6143
  return { content };
6146
6144
  } catch (e) {