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