@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/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 {
@@ -5502,15 +5500,13 @@ function registerSketchTools(server, state) {
5502
5500
  target: "sketch",
5503
5501
  sketchId: args.id
5504
5502
  });
5505
- const captureMeta = captureResult.metadata;
5506
5503
  return {
5507
5504
  content: [
5505
+ { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5508
5506
  { type: "text", text: JSON.stringify({
5509
5507
  ...result,
5510
- capture: captureMeta
5511
- }, null, 2) },
5512
- { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5513
- ...captureMeta.savedPreviewTo ? [{ type: "text", text: `![Sketch Preview](file://${captureMeta.savedPreviewTo})` }] : []
5508
+ capture: captureResult.metadata
5509
+ }, null, 2) }
5514
5510
  ]
5515
5511
  };
5516
5512
  } catch (captureErr) {
@@ -6076,7 +6072,7 @@ function registerSnapshotTools(server, state) {
6076
6072
  function registerCaptureTools(server, state) {
6077
6073
  server.tool(
6078
6074
  "capture_screenshot",
6079
- "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).",
6080
6076
  {
6081
6077
  target: import_zod2.z.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
6082
6078
  sketchId: import_zod2.z.string().optional().describe("Required when target is 'sketch'"),
@@ -6089,13 +6085,11 @@ function registerCaptureTools(server, state) {
6089
6085
  async (args) => {
6090
6086
  try {
6091
6087
  const result = await captureScreenshot(state, args);
6092
- 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}`);
6093
6089
  return {
6094
6090
  content: [
6095
- { type: "text", text: JSON.stringify(result.metadata, null, 2) },
6096
6091
  { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
6097
- // Markdown image for hosts that render local file refs or data URIs
6098
- ...result.metadata.savedPreviewTo ? [{ type: "text", text: `![Sketch Preview](file://${result.metadata.savedPreviewTo})` }] : []
6092
+ { type: "text", text: JSON.stringify(result.metadata, null, 2) }
6099
6093
  ]
6100
6094
  };
6101
6095
  } catch (e) {
@@ -6106,7 +6100,7 @@ function registerCaptureTools(server, state) {
6106
6100
  );
6107
6101
  server.tool(
6108
6102
  "capture_batch",
6109
- "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/.",
6110
6104
  {
6111
6105
  sketchIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("IDs of sketches to capture (default: all)"),
6112
6106
  width: import_zod2.z.number().optional().describe("Override width for all captures"),
@@ -6121,21 +6115,15 @@ function registerCaptureTools(server, state) {
6121
6115
  { type: "text", text: JSON.stringify(result.metadata, null, 2) }
6122
6116
  ];
6123
6117
  for (const item of result.items) {
6124
- content.push({
6125
- type: "text",
6126
- text: JSON.stringify(item.metadata, null, 2)
6127
- });
6128
6118
  content.push({
6129
6119
  type: "image",
6130
6120
  data: item.inlineJpegBase64,
6131
6121
  mimeType: "image/jpeg"
6132
6122
  });
6133
- if (item.metadata.savedPreviewTo) {
6134
- content.push({
6135
- type: "text",
6136
- text: `![${item.metadata.sketchId} Preview](file://${item.metadata.savedPreviewTo})`
6137
- });
6138
- }
6123
+ content.push({
6124
+ type: "text",
6125
+ text: JSON.stringify(item.metadata, null, 2)
6126
+ });
6139
6127
  }
6140
6128
  return { content };
6141
6129
  } catch (e) {