@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.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 {
@@ -5517,15 +5515,13 @@ function registerSketchTools(server, state) {
5517
5515
  target: "sketch",
5518
5516
  sketchId: args.id
5519
5517
  });
5520
- const captureMeta = captureResult.metadata;
5521
5518
  return {
5522
5519
  content: [
5520
+ { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5523
5521
  { type: "text", text: JSON.stringify({
5524
5522
  ...result,
5525
- capture: captureMeta
5526
- }, null, 2) },
5527
- { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5528
- ...captureMeta.savedPreviewTo ? [{ type: "text", text: `![Sketch Preview](file://${captureMeta.savedPreviewTo})` }] : []
5523
+ capture: captureResult.metadata
5524
+ }, null, 2) }
5529
5525
  ]
5530
5526
  };
5531
5527
  } catch (captureErr) {
@@ -6091,7 +6087,7 @@ function registerSnapshotTools(server, state) {
6091
6087
  function registerCaptureTools(server, state) {
6092
6088
  server.tool(
6093
6089
  "capture_screenshot",
6094
- "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).",
6095
6091
  {
6096
6092
  target: z2.enum(["selected", "sketch"]).optional().describe("What to capture (default: selected)"),
6097
6093
  sketchId: z2.string().optional().describe("Required when target is 'sketch'"),
@@ -6104,13 +6100,11 @@ function registerCaptureTools(server, state) {
6104
6100
  async (args) => {
6105
6101
  try {
6106
6102
  const result = await captureScreenshot(state, args);
6107
- 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}`);
6108
6104
  return {
6109
6105
  content: [
6110
- { type: "text", text: JSON.stringify(result.metadata, null, 2) },
6111
6106
  { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
6112
- // Markdown image for hosts that render local file refs or data URIs
6113
- ...result.metadata.savedPreviewTo ? [{ type: "text", text: `![Sketch Preview](file://${result.metadata.savedPreviewTo})` }] : []
6107
+ { type: "text", text: JSON.stringify(result.metadata, null, 2) }
6114
6108
  ]
6115
6109
  };
6116
6110
  } catch (e) {
@@ -6121,7 +6115,7 @@ function registerCaptureTools(server, state) {
6121
6115
  );
6122
6116
  server.tool(
6123
6117
  "capture_batch",
6124
- "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/.",
6125
6119
  {
6126
6120
  sketchIds: z2.array(z2.string()).optional().describe("IDs of sketches to capture (default: all)"),
6127
6121
  width: z2.number().optional().describe("Override width for all captures"),
@@ -6136,21 +6130,15 @@ function registerCaptureTools(server, state) {
6136
6130
  { type: "text", text: JSON.stringify(result.metadata, null, 2) }
6137
6131
  ];
6138
6132
  for (const item of result.items) {
6139
- content.push({
6140
- type: "text",
6141
- text: JSON.stringify(item.metadata, null, 2)
6142
- });
6143
6133
  content.push({
6144
6134
  type: "image",
6145
6135
  data: item.inlineJpegBase64,
6146
6136
  mimeType: "image/jpeg"
6147
6137
  });
6148
- if (item.metadata.savedPreviewTo) {
6149
- content.push({
6150
- type: "text",
6151
- text: `![${item.metadata.sketchId} Preview](file://${item.metadata.savedPreviewTo})`
6152
- });
6153
- }
6138
+ content.push({
6139
+ type: "text",
6140
+ text: JSON.stringify(item.metadata, null, 2)
6141
+ });
6154
6142
  }
6155
6143
  return { content };
6156
6144
  } catch (e) {