@genart-dev/mcp-server 0.4.7 → 0.4.9

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
@@ -2424,6 +2424,7 @@ function isDirectComponent(name, components) {
2424
2424
  }
2425
2425
 
2426
2426
  // src/tools/capture.ts
2427
+ import { exec } from "child_process";
2427
2428
  import { mkdir, writeFile as writeFile5 } from "fs/promises";
2428
2429
  import { dirname as dirname5, join as join3 } from "path";
2429
2430
  import {
@@ -2509,6 +2510,12 @@ async function captureHtmlMulti(options) {
2509
2510
 
2510
2511
  // src/tools/capture.ts
2511
2512
  var registry2 = createDefaultRegistry2();
2513
+ function openPreview(filePath) {
2514
+ const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
2515
+ exec(`${cmd} "${filePath}"`, (err) => {
2516
+ if (err) console.error(`[openPreview] failed: ${err.message}`);
2517
+ });
2518
+ }
2512
2519
  function applyOverrides(sketch, overrides) {
2513
2520
  if (overrides.seed === void 0 && overrides.params === void 0) {
2514
2521
  return sketch;
@@ -2595,6 +2602,9 @@ async function buildScreenshotMetadata(state, multi, info) {
2595
2602
  await writeFile5(info.previewPath, multi.previewPng);
2596
2603
  metadata.savedPreviewTo = info.previewPath;
2597
2604
  metadata.previewWritten = true;
2605
+ if (info.autoOpen !== false) {
2606
+ openPreview(info.previewPath);
2607
+ }
2598
2608
  }
2599
2609
  return metadata;
2600
2610
  }
@@ -2629,7 +2639,9 @@ async function captureBatch(state, input) {
2629
2639
  target: "sketch",
2630
2640
  sketchId: id,
2631
2641
  seed: effectiveSeed,
2632
- previewPath
2642
+ previewPath,
2643
+ autoOpen: false
2644
+ // Don't flood windows for batch captures
2633
2645
  });
2634
2646
  items.push({
2635
2647
  metadata: itemMetadata,
@@ -5198,7 +5210,12 @@ function registerSketchTools(server, state) {
5198
5210
  });
5199
5211
  return {
5200
5212
  content: [
5201
- { type: "image", data: captureResult.previewJpegBase64, mimeType: "image/jpeg" },
5213
+ {
5214
+ type: "image",
5215
+ data: captureResult.previewJpegBase64,
5216
+ mimeType: "image/jpeg",
5217
+ annotations: { audience: ["user", "assistant"] }
5218
+ },
5202
5219
  { type: "text", text: JSON.stringify({
5203
5220
  ...result,
5204
5221
  capture: captureResult.metadata
@@ -5784,7 +5801,12 @@ function registerCaptureTools(server, state) {
5784
5801
  console.error(`[capture_screenshot] jpeg base64 length: ${result.previewJpegBase64.length}`);
5785
5802
  return {
5786
5803
  content: [
5787
- { type: "image", data: result.previewJpegBase64, mimeType: "image/jpeg" },
5804
+ {
5805
+ type: "image",
5806
+ data: result.previewJpegBase64,
5807
+ mimeType: "image/jpeg",
5808
+ annotations: { audience: ["user", "assistant"] }
5809
+ },
5788
5810
  { type: "text", text: JSON.stringify(result.metadata, null, 2) }
5789
5811
  ]
5790
5812
  };
@@ -5814,7 +5836,8 @@ function registerCaptureTools(server, state) {
5814
5836
  content.push({
5815
5837
  type: "image",
5816
5838
  data: item.inlineJpegBase64,
5817
- mimeType: "image/jpeg"
5839
+ mimeType: "image/jpeg",
5840
+ annotations: { audience: ["user", "assistant"] }
5818
5841
  });
5819
5842
  content.push({
5820
5843
  type: "text",