@genart-dev/mcp-server 0.4.6 → 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 {
@@ -5203,15 +5201,13 @@ function registerSketchTools(server, state) {
5203
5201
  target: "sketch",
5204
5202
  sketchId: args.id
5205
5203
  });
5206
- const captureMeta = captureResult.metadata;
5207
5204
  return {
5208
5205
  content: [
5206
+ { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5209
5207
  { type: "text", text: JSON.stringify({
5210
5208
  ...result,
5211
- capture: captureMeta
5212
- }, null, 2) },
5213
- { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5214
- ...captureMeta.savedPreviewTo ? [{ type: "text", text: `![Sketch Preview](file://${captureMeta.savedPreviewTo})` }] : []
5209
+ capture: captureResult.metadata
5210
+ }, null, 2) }
5215
5211
  ]
5216
5212
  };
5217
5213
  } catch (captureErr) {
@@ -5777,7 +5773,7 @@ function registerSnapshotTools(server, state) {
5777
5773
  function registerCaptureTools(server, state) {
5778
5774
  server.tool(
5779
5775
  "capture_screenshot",
5780
- "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).",
5781
5777
  {
5782
5778
  target: import_zod2.z.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
5783
5779
  sketchId: import_zod2.z.string().optional().describe("Required when target is 'sketch'"),
@@ -5790,13 +5786,11 @@ function registerCaptureTools(server, state) {
5790
5786
  async (args) => {
5791
5787
  try {
5792
5788
  const result = await captureScreenshot(state, args);
5793
- 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}`);
5794
5790
  return {
5795
5791
  content: [
5796
- { type: "text", text: JSON.stringify(result.metadata, null, 2) },
5797
5792
  { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
5798
- // Markdown image for hosts that render local file refs or data URIs
5799
- ...result.metadata.savedPreviewTo ? [{ type: "text", text: `![Sketch Preview](file://${result.metadata.savedPreviewTo})` }] : []
5793
+ { type: "text", text: JSON.stringify(result.metadata, null, 2) }
5800
5794
  ]
5801
5795
  };
5802
5796
  } catch (e) {
@@ -5807,7 +5801,7 @@ function registerCaptureTools(server, state) {
5807
5801
  );
5808
5802
  server.tool(
5809
5803
  "capture_batch",
5810
- "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/.",
5811
5805
  {
5812
5806
  sketchIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("IDs of sketches to capture (default: all)"),
5813
5807
  width: import_zod2.z.number().optional().describe("Override width for all captures"),
@@ -5822,21 +5816,15 @@ function registerCaptureTools(server, state) {
5822
5816
  { type: "text", text: JSON.stringify(result.metadata, null, 2) }
5823
5817
  ];
5824
5818
  for (const item of result.items) {
5825
- content.push({
5826
- type: "text",
5827
- text: JSON.stringify(item.metadata, null, 2)
5828
- });
5829
5819
  content.push({
5830
5820
  type: "image",
5831
5821
  data: item.inlineJpegBase64,
5832
5822
  mimeType: "image/jpeg"
5833
5823
  });
5834
- if (item.metadata.savedPreviewTo) {
5835
- content.push({
5836
- type: "text",
5837
- text: `![${item.metadata.sketchId} Preview](file://${item.metadata.savedPreviewTo})`
5838
- });
5839
- }
5824
+ content.push({
5825
+ type: "text",
5826
+ text: JSON.stringify(item.metadata, null, 2)
5827
+ });
5840
5828
  }
5841
5829
  return { content };
5842
5830
  } catch (e) {