@productmaker/mcp 2.10.1 → 3.0.0

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/stdio.js CHANGED
@@ -154,16 +154,15 @@ var ApiClient = class {
154
154
  };
155
155
 
156
156
  // src/index.ts
157
- var MCP_VERSION = "2.10.1";
157
+ var MCP_VERSION = "3.0.0";
158
158
 
159
159
  // src/meta-upload-app.ts
160
160
  import { readFileSync } from "fs";
161
161
  import { registerAppResource, RESOURCE_MIME_TYPE } from "@modelcontextprotocol/ext-apps/server";
162
- var META_UPLOAD_APP_RESOURCE_URI = "ui://meta-upload/v1.html";
163
162
  var MEDIA_UPLOAD_APP_RESOURCE_URI = "ui://media-upload/v1.html";
164
- var META_UPLOAD_APP_NAME = "ProductMaker media upload";
165
- var META_UPLOAD_APP_HTML_URL = new URL("./ui/meta-upload-app.html", import.meta.url);
166
- var META_UPLOAD_APP_CSP = {
163
+ var MEDIA_UPLOAD_APP_NAME = "ProductMaker media upload";
164
+ var MEDIA_UPLOAD_APP_HTML_URL = new URL("./ui/meta-upload-app.html", import.meta.url);
165
+ var MEDIA_UPLOAD_APP_CSP = {
167
166
  connectDomains: [
168
167
  "https://productmaker.app",
169
168
  "https://www.productmaker.app",
@@ -171,46 +170,41 @@ var META_UPLOAD_APP_CSP = {
171
170
  "https://*.oaiusercontent.com"
172
171
  ]
173
172
  };
174
- function readMetaUploadAppHtml(htmlUrl = META_UPLOAD_APP_HTML_URL) {
173
+ function readMediaUploadAppHtml(htmlUrl = MEDIA_UPLOAD_APP_HTML_URL) {
175
174
  try {
176
175
  return readFileSync(htmlUrl, "utf8");
177
176
  } catch (error) {
178
177
  const message = error instanceof Error ? error.message : String(error);
179
- throw new Error(`Missing packaged Meta upload app HTML at ${htmlUrl.pathname}. Rebuild @productmaker/mcp so ${META_UPLOAD_APP_RESOURCE_URI} is bundled. Original error: ${message}`);
178
+ throw new Error(`Missing packaged media upload app HTML at ${htmlUrl.pathname}. Rebuild @productmaker/mcp so ${MEDIA_UPLOAD_APP_RESOURCE_URI} is bundled. Original error: ${message}`);
180
179
  }
181
180
  }
182
- __name(readMetaUploadAppHtml, "readMetaUploadAppHtml");
183
- function registerMetaUploadAppResource(server) {
184
- const html = readMetaUploadAppHtml();
185
- for (const resourceUri of [
186
- MEDIA_UPLOAD_APP_RESOURCE_URI,
187
- META_UPLOAD_APP_RESOURCE_URI
188
- ]) {
189
- registerAppResource(server, `${META_UPLOAD_APP_NAME} (${resourceUri})`, resourceUri, {
190
- title: "Upload media",
191
- mimeType: RESOURCE_MIME_TYPE,
192
- _meta: {
193
- ui: {
194
- csp: META_UPLOAD_APP_CSP
195
- }
181
+ __name(readMediaUploadAppHtml, "readMediaUploadAppHtml");
182
+ function registerMediaUploadAppResource(server) {
183
+ const html = readMediaUploadAppHtml();
184
+ registerAppResource(server, MEDIA_UPLOAD_APP_NAME, MEDIA_UPLOAD_APP_RESOURCE_URI, {
185
+ title: "Upload media",
186
+ mimeType: RESOURCE_MIME_TYPE,
187
+ _meta: {
188
+ ui: {
189
+ csp: MEDIA_UPLOAD_APP_CSP
196
190
  }
197
- }, async () => ({
198
- contents: [
199
- {
200
- uri: resourceUri,
201
- mimeType: RESOURCE_MIME_TYPE,
202
- text: html,
203
- _meta: {
204
- ui: {
205
- csp: META_UPLOAD_APP_CSP
206
- }
191
+ }
192
+ }, async () => ({
193
+ contents: [
194
+ {
195
+ uri: MEDIA_UPLOAD_APP_RESOURCE_URI,
196
+ mimeType: RESOURCE_MIME_TYPE,
197
+ text: html,
198
+ _meta: {
199
+ ui: {
200
+ csp: MEDIA_UPLOAD_APP_CSP
207
201
  }
208
202
  }
209
- ]
210
- }));
211
- }
203
+ }
204
+ ]
205
+ }));
212
206
  }
213
- __name(registerMetaUploadAppResource, "registerMetaUploadAppResource");
207
+ __name(registerMediaUploadAppResource, "registerMediaUploadAppResource");
214
208
 
215
209
  // src/tools/tasks.ts
216
210
  import { z as z47 } from "zod";
@@ -4908,46 +4902,47 @@ var DEFAULT_PRICING = {
4908
4902
  },
4909
4903
  // Grok Imagine I2V pricing by duration/resolution (grok-imagine/image-to-video).
4910
4904
  // Provider unified ALL grok-imagine-1.5 renders (silent multi-clip AND native-audio
4911
- // single-call) onto ONE per-second rate on 2026-06-22: $0.008/s @ 480p, $0.015/s @ 720p
4912
- // (was a split table where native audio billed ~10× the silent per-second tier).
4905
+ // single-call) onto ONE per-second rate on 2026-06-22 (then $0.008/s @ 480p,
4906
+ // $0.015/s @ 720p). Provider RAISED that unified rate on 2026-08-06 to
4907
+ // $0.012/s @ 480p and $0.0225/s @ 720p (+50%) — the rates below.
4913
4908
  // Flat duration keys below = perSecondRate × seconds; userPrice = GROK_USER_MARKUP × cost.
4914
4909
  //
4915
- // ⚠️ GROK BILLS AT GROK_USER_MARKUP (2.5×), NOT THE 2× HOUSE RATE — see the
4916
- // rationale on that constant above. Every other provider family stays at 2×.
4910
+ // Grok bills at GROK_USER_MARKUP, which is the 2× house rate again since
4911
+ // 2026-08-06 (the 2.5× exception was reverted — see that constant above).
4917
4912
  "kie:video-generation:grok-6s-480p": {
4918
- ourCostCents: 4.8,
4919
- userPriceCents: 12
4913
+ ourCostCents: 7.2,
4914
+ userPriceCents: 14.4
4920
4915
  },
4921
4916
  "kie:video-generation:grok-6s-720p": {
4922
- ourCostCents: 9,
4923
- userPriceCents: 22.5
4917
+ ourCostCents: 13.5,
4918
+ userPriceCents: 27
4924
4919
  },
4925
4920
  "kie:video-generation:grok-10s-480p": {
4926
- ourCostCents: 8,
4927
- userPriceCents: 20
4921
+ ourCostCents: 12,
4922
+ userPriceCents: 24
4928
4923
  },
4929
4924
  "kie:video-generation:grok-10s-720p": {
4930
- ourCostCents: 15,
4931
- userPriceCents: 37.5
4925
+ ourCostCents: 22.5,
4926
+ userPriceCents: 45
4932
4927
  },
4933
4928
  "kie:video-generation:grok-15s-480p": {
4934
- ourCostCents: 12,
4935
- userPriceCents: 30
4929
+ ourCostCents: 18,
4930
+ userPriceCents: 36
4936
4931
  },
4937
4932
  "kie:video-generation:grok-15s-720p": {
4938
- ourCostCents: 22.5,
4939
- userPriceCents: 56.25
4933
+ ourCostCents: 33.75,
4934
+ userPriceCents: 67.5
4940
4935
  },
4941
4936
  // Grok Imagine Video 1.5 PER-SECOND (rapid/standard multi-clip path; SAME unified
4942
- // $/s as the flat keys above: $0.008/s 480p, $0.015/s 720p). Billed units = perClipSeconds.
4937
+ // $/s as the flat keys above: $0.012/s 480p, $0.0225/s 720p). Billed units = perClipSeconds.
4943
4938
  // userPrice must stay flat_key ÷ 15 so a 15s render costs the same on either path.
4944
4939
  "kie:video-generation:grok15-persec-480p": {
4945
- ourCostCents: 0.8,
4946
- userPriceCents: 2
4940
+ ourCostCents: 1.2,
4941
+ userPriceCents: 2.4
4947
4942
  },
4948
4943
  "kie:video-generation:grok15-persec-720p": {
4949
- ourCostCents: 1.5,
4950
- userPriceCents: 3.75
4944
+ ourCostCents: 2.25,
4945
+ userPriceCents: 4.5
4951
4946
  },
4952
4947
  // Free-video subtitle burn: one final Whisper transcription per rendered second.
4953
4948
  // The worker uses this exact action with units=Math.ceil(finalAudioDuration).
@@ -4998,11 +4993,11 @@ var DEFAULT_PRICING = {
4998
4993
  // rate (same as kie: key above); ourCost = real Fal cost (we absorb the premium on rare failover).
4999
4994
  "fal:video-generation:grok-15s-480p": {
5000
4995
  ourCostCents: 121,
5001
- userPriceCents: 30
4996
+ userPriceCents: 36
5002
4997
  },
5003
4998
  "fal:video-generation:grok-15s-720p": {
5004
4999
  ourCostCents: 211,
5005
- userPriceCents: 56.25
5000
+ userPriceCents: 67.5
5006
5001
  },
5007
5002
  // Fal Grok Imagine 1.5 PER-SECOND failover pricing (rapid/STANDARD multi-clip path —
5008
5003
  // mirrors kie:video-generation:grok15-persec-* above, SAME $0.08/s (480p) / $0.14/s
@@ -5012,11 +5007,11 @@ var DEFAULT_PRICING = {
5012
5007
  // .superpowers/sdd/fal-grok-rapid-brief.md.
5013
5008
  "fal:video-generation:grok15-persec-480p": {
5014
5009
  ourCostCents: 8,
5015
- userPriceCents: 2
5010
+ userPriceCents: 2.4
5016
5011
  },
5017
5012
  "fal:video-generation:grok15-persec-720p": {
5018
5013
  ourCostCents: 14,
5019
- userPriceCents: 3.75
5014
+ userPriceCents: 4.5
5020
5015
  },
5021
5016
  "kie:video-generation:wan": {
5022
5017
  ourCostCents: 30,
@@ -5883,18 +5878,18 @@ var DEFAULT_PRICING = {
5883
5878
  },
5884
5879
  // ─── Video Regenerate pricing keys ────────────────────────────────────────
5885
5880
  // Billed by priceVideoRegenerateSection() below; keys kept for audit trail.
5886
- // multi_shot: one grok i2v clip per scene (~3s @ 480p: 0.8¢/s × 3s = 2.4¢ our / 6¢ user)
5887
- // single_call: one 15s native-audio grok-1.5 whole-video render (12¢ our / 30¢ user)
5881
+ // multi_shot: one grok i2v clip per scene (~3s @ 480p: 1.2¢/s × 3s = 3.6¢ our / 7.2¢ user)
5882
+ // single_call: one 15s native-audio grok-1.5 whole-video render (18¢ our / 36¢ user)
5888
5883
  // Both are grok renders, so both carry GROK_USER_MARKUP — and both match what the
5889
- // initial-render keys charge for the identical clip (grok15-persec-480p × 3s = 6¢;
5890
- // grok-15s-480p = 30¢).
5884
+ // initial-render keys charge for the identical clip (grok15-persec-480p × 3s = 7.2¢;
5885
+ // grok-15s-480p = 36¢).
5891
5886
  "kie:video-regen:multi_shot-per-scene": {
5892
- ourCostCents: 2.4,
5893
- userPriceCents: 6
5887
+ ourCostCents: 3.6,
5888
+ userPriceCents: 7.2
5894
5889
  },
5895
5890
  "kie:video-regen:single_call": {
5896
- ourCostCents: 12,
5897
- userPriceCents: 30
5891
+ ourCostCents: 18,
5892
+ userPriceCents: 36
5898
5893
  },
5899
5894
  // ─── Competitor Video Transcripts (OpenAI Whisper) ────────────────────────
5900
5895
  // Unit = one successfully transcribed video ad opening (~8s of audio).
@@ -8068,11 +8063,19 @@ var ServiceMediaAnalysisSchema = z43.object({
8068
8063
  });
8069
8064
 
8070
8065
  // ../../packages/types/src/productmaker-capability-registry.ts
8071
- var CHANNEL_EXPOSURE = {
8066
+ var SHARED_CHANNEL_EXPOSURE = {
8067
+ mcp: "direct",
8068
+ whatsapp: "adapted"
8069
+ };
8070
+ var MCP_ONLY_CHANNEL_EXPOSURE = {
8072
8071
  mcp: "direct",
8072
+ whatsapp: "unavailable"
8073
+ };
8074
+ var WHATSAPP_ONLY_CHANNEL_EXPOSURE = {
8075
+ mcp: "unavailable",
8073
8076
  whatsapp: "adapted"
8074
8077
  };
8075
- function defineCapability(name, schemaHash, confirmation, routingDomain, effects, inputSlots, consumes, produces) {
8078
+ function defineCapability(name, schemaHash, confirmation, routingDomain, effects, inputSlots, consumes, produces, channelExposure = SHARED_CHANNEL_EXPOSURE) {
8076
8079
  return {
8077
8080
  name,
8078
8081
  schemaHash,
@@ -8084,7 +8087,7 @@ function defineCapability(name, schemaHash, confirmation, routingDomain, effects
8084
8087
  consumes,
8085
8088
  produces
8086
8089
  },
8087
- channelExposure: CHANNEL_EXPOSURE
8090
+ channelExposure
8088
8091
  };
8089
8092
  }
8090
8093
  __name(defineCapability, "defineCapability");
@@ -8168,7 +8171,18 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
8168
8171
  "meta_upload_session"
8169
8172
  ], [
8170
8173
  "staging_asset"
8171
- ]),
8174
+ ], WHATSAPP_ONLY_CHANNEL_EXPOSURE),
8175
+ defineCapability("check_media_upload", "daf202e0ff3a7a14425d164a7be6a81922b12233e85dbb898894e7c3ba6c5876", "none", "read_only", [
8176
+ "read"
8177
+ ], [
8178
+ slot("upload_session", true, [
8179
+ "sessionId"
8180
+ ], [])
8181
+ ], [
8182
+ "media_upload_session"
8183
+ ], [
8184
+ "uploaded_asset"
8185
+ ], MCP_ONLY_CHANNEL_EXPOSURE),
8172
8186
  defineCapability("cost_dropshipping_project", "746797b5400b170ba3a0704d432afff635794f0a7ae0b9da07b26d49e3b82242", "state_change", "business", [
8173
8187
  "state_change"
8174
8188
  ], [
@@ -8449,7 +8463,7 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
8449
8463
  ], [
8450
8464
  "product_research_run"
8451
8465
  ]),
8452
- defineCapability("generate_free_video", "aa33aeb9a77976ba0841e3b11d1228038f63689ca9e635012f13e305a06ca37b", "credit_consuming", "creative", [
8466
+ defineCapability("generate_free_video", "01f5e412c4ae3a8e1d97ded33f5cf38c4505f02fcf301dad90c37655c8de783f", "credit_consuming", "creative", [
8453
8467
  "credit_consuming",
8454
8468
  "state_change"
8455
8469
  ], [
@@ -8790,7 +8804,7 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
8790
8804
  ], [
8791
8805
  "tiktok_advertiser"
8792
8806
  ]),
8793
- defineCapability("publish_creatives_to_meta", "fe5ef259beaf113d74fd2d3f26f14fbbb3a7660be00ab44384441d2af837d731", "external_mutation", "publishing", [
8807
+ defineCapability("publish_creatives_to_meta", "b3a487134a1f5392d7a526348a03e952a317ae5d9ff01bae10bbe24ec5fe3fc8", "external_mutation", "publishing", [
8794
8808
  "external_mutation",
8795
8809
  "state_change"
8796
8810
  ], [
@@ -8959,7 +8973,27 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
8959
8973
  "media_upload_request"
8960
8974
  ], [
8961
8975
  "meta_upload_session"
8962
- ]),
8976
+ ], WHATSAPP_ONLY_CHANNEL_EXPOSURE),
8977
+ defineCapability("request_media_upload", "794e9b279b49d0e818423fa4ae9f1a4a52689620abc3520380d7e86a3630380f", "none", "creative", [
8978
+ "state_change"
8979
+ ], [
8980
+ slot("media_kind", true, [
8981
+ "mediaKind"
8982
+ ], []),
8983
+ slot("asset_role", false, [
8984
+ "assetRole"
8985
+ ], []),
8986
+ slot("file_limit", false, [
8987
+ "maxFiles"
8988
+ ], []),
8989
+ slot("host_files", false, [
8990
+ "files"
8991
+ ], [])
8992
+ ], [
8993
+ "media_upload_request"
8994
+ ], [
8995
+ "media_upload_session"
8996
+ ], MCP_ONLY_CHANNEL_EXPOSURE),
8963
8997
  defineCapability("resolve_pending_action", "2fae350d14ba3fdab63914ca3b442472a002d97cffc85b6f207b1cc7e320ecdb", "credit_consuming", "creative", [
8964
8998
  "credit_consuming",
8965
8999
  "state_change"
@@ -9017,6 +9051,9 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
9017
9051
  ])
9018
9052
  ]);
9019
9053
  var PRODUCTMAKER_CAPABILITY_NAMES = PRODUCTMAKER_CAPABILITY_REGISTRY.map((capability) => capability.name);
9054
+ var PRODUCTMAKER_MCP_CAPABILITY_REGISTRY = PRODUCTMAKER_CAPABILITY_REGISTRY.filter((capability) => capability.channelExposure.mcp === "direct");
9055
+ var PRODUCTMAKER_WHATSAPP_CAPABILITY_REGISTRY = PRODUCTMAKER_CAPABILITY_REGISTRY.filter((capability) => capability.channelExposure.whatsapp === "adapted");
9056
+ var PRODUCTMAKER_WHATSAPP_CAPABILITY_NAMES = PRODUCTMAKER_WHATSAPP_CAPABILITY_REGISTRY.map((capability) => capability.name);
9020
9057
 
9021
9058
  // ../../packages/types/src/productmaker-chat-capabilities.ts
9022
9059
  function toLegacyCapabilityCatalog(catalog) {
@@ -9027,7 +9064,8 @@ function toLegacyCapabilityCatalog(catalog) {
9027
9064
  }));
9028
9065
  }
9029
9066
  __name(toLegacyCapabilityCatalog, "toLegacyCapabilityCatalog");
9030
- var PRODUCTMAKER_MCP_CAPABILITIES = toLegacyCapabilityCatalog(PRODUCTMAKER_CAPABILITY_REGISTRY);
9067
+ var PRODUCTMAKER_MCP_CAPABILITIES = toLegacyCapabilityCatalog(PRODUCTMAKER_MCP_CAPABILITY_REGISTRY);
9068
+ var PRODUCTMAKER_MCP_CAPABILITY_NAMES = PRODUCTMAKER_MCP_CAPABILITY_REGISTRY.map((capability) => capability.name);
9031
9069
 
9032
9070
  // ../../packages/types/src/actor.ts
9033
9071
  import { z as z44 } from "zod";
@@ -11097,7 +11135,7 @@ var FREE_VIDEO_DURATIONS_BY_QUALITY = {
11097
11135
  ]
11098
11136
  };
11099
11137
  var FreeVideoInput = z48.object({
11100
- images: ImagesInput.optional().describe("Opcional. 1-5 fotos del producto. Om\xEDtelo para generar desde texto puro."),
11138
+ images: ImagesInput.optional().describe("Opcional. 1-5 fotos del producto. Si el usuario adjunt\xF3 o mencion\xF3 fotos locales y no existe un assetId reutilizable, llama primero request_media_upload con mediaKind=image y usa los assetId devueltos; no pidas rutas ni URLs. Om\xEDtelo para generar desde texto puro."),
11101
11139
  rawPrompt: z48.string().trim().min(1).max(2e3).describe("Prompt o guion exacto del video. Si activas subt\xEDtulos, este mismo texto se usa como guion de subt\xEDtulos."),
11102
11140
  quality: FreeVideoQualityEnum.describe('Calidad del video: "economical" = Econ\xF3mico o "high_detail" = Alto detalle.'),
11103
11141
  durationSeconds: z48.number().int().min(1).max(15).describe("Duraci\xF3n exacta. Econ\xF3mico permite 6, 8, 10 o 15s; Alto detalle permite 4, 8, 12 o 15s."),
@@ -11169,7 +11207,7 @@ var LandingInput = z48.object({
11169
11207
  subheadline: CreativeRefs.subheadline
11170
11208
  });
11171
11209
  function registerCreativeTools(server, api, { transport = "http" } = {}) {
11172
- server.tool("generate_free_video", 'Genera UN video libre con prompt/guion exacto, opcionalmente con imagen de referencia. Devuelve un taskId y procesa el job de forma as\xEDncrona.\n\nREQUERIDOS: rawPrompt, quality, durationSeconds y videoResolution.\n\nCALIDAD: "economical" = Econ\xF3mico y "high_detail" = Alto detalle. La duraci\xF3n debe pertenecer a la lista admitida por la calidad escogida; si el usuario pide otra, preg\xFAntale una duraci\xF3n v\xE1lida.\n\nSUBT\xCDTULOS: si addSubtitles=true, el rawPrompt completo se usa como texto exacto de subt\xEDtulos y debe tener m\xE1ximo 500 caracteres; no existe una pregunta adicional de transcripci\xF3n.\n\nPara videos normales con narrativa/\xE1ngulo usa generate_video_creative. Para tareas combinadas de producto usa create_product_task.', FreeVideoInput.shape, async (input) => {
11210
+ server.tool("generate_free_video", 'Genera UN video libre con prompt/guion exacto, opcionalmente con imagen de referencia. Si el usuario adjunta o menciona una imagen local, llama primero request_media_upload con mediaKind=image y usa el assetId devuelto; no pidas path ni URL. Devuelve un taskId y procesa el job de forma as\xEDncrona.\n\nREQUERIDOS: rawPrompt, quality, durationSeconds y videoResolution.\n\nCALIDAD: "economical" = Econ\xF3mico y "high_detail" = Alto detalle. La duraci\xF3n debe pertenecer a la lista admitida por la calidad escogida; si el usuario pide otra, preg\xFAntale una duraci\xF3n v\xE1lida.\n\nSUBT\xCDTULOS: si addSubtitles=true, el rawPrompt completo se usa como texto exacto de subt\xEDtulos y debe tener m\xE1ximo 500 caracteres; no existe una pregunta adicional de transcripci\xF3n.\n\nPara videos normales con narrativa/\xE1ngulo usa generate_video_creative. Para tareas combinadas de producto usa create_product_task.', FreeVideoInput.shape, async (input) => {
11173
11211
  try {
11174
11212
  const allowedDurations = FREE_VIDEO_DURATIONS_BY_QUALITY[input.quality];
11175
11213
  if (!allowedDurations.includes(input.durationSeconds)) {
@@ -11199,7 +11237,7 @@ function registerCreativeTools(server, api, { transport = "http" } = {}) {
11199
11237
  throw translateError(e);
11200
11238
  }
11201
11239
  });
11202
- server.tool("generate_video_creative", 'Genera UN video creativo independiente. Devuelve un taskId.\n\nREQUERIDOS: images (array de 1-5 fotos), title, primaryAngle, language, country, aspectRatio.\n\nANTES de invocar, PREG\xDANTALE al usuario por price y offer si no los mencion\xF3 \u2014 son los inputs de mayor impacto en conversi\xF3n y nunca debes asumirlos. NO defaultes country/language desde el contexto: preg\xFAntale expl\xEDcitamente. Si el usuario te dice "t\xFA elige" para price/offer, om\xEDtelos.\n\nOTROS OPCIONALES (puedes invocar sin ellos y dejar que la IA elija defaults sensatos): durationSeconds (15 o 30), videoPreset (tipo/narrativa del video), features, cta, scriptNotes (dirige el guion Y el ambiente/escenario/est\xE9tica del video, ej. "en una playa, opulento").\n\nCOMPETENCIA Y GAP REPLICATION: con videoPreset="auto" (default) y competitorScanEnabled=true (default), el sistema analiza anuncios de competencia. Si encuentra un winner de video coherente, ancla el primaryAngle y genera autom\xE1ticamente la narrativa `gap_replication` para copiar su estructura audiovisual. No la selecciones manualmente: es un resultado del an\xE1lisis. Si competitorScanEnabled=false, esta b\xFAsqueda se omite.\n\nESTILO: 15s usa "Realista" (single_call); 30s usa "Multiescena" (multi-toma, aproximadamente 30s). Multiescena se factura por escena, as\xED que avisa el costo antes de activarlo.\n\nGUION: el usuario NO escribe el guion desde cero \u2014 la IA lo redacta. Si quiere REVISARLO/EDITARLO antes de renderizar (igual que en la web), pasa `pauseForVideoScriptReview: true`; cuando la tarea quede pausada, usa get_video_script para leer las escenas, ofr\xE9celas al usuario, y llama approve_video_script con las ediciones. Para dirigir el guion ANTES de generar (sin pausar), usa scriptNotes. Para revisar el \xE1ngulo y decidir duraci\xF3n tras el an\xE1lisis de competencia, pasa `pauseForAngleReview: true` y luego resuelve `angle_review_approval` con `gapDurationSeconds`.', VideoInput.shape, async (input) => {
11240
+ server.tool("generate_video_creative", 'Genera UN video creativo independiente. Devuelve un taskId.\n\nREQUERIDOS: images (array de 1-5 fotos), title, primaryAngle, language, country, aspectRatio. Si el usuario adjunta o menciona fotos locales y a\xFAn no hay assetId, llama primero `request_media_upload` con mediaKind=image y despu\xE9s usa los assetId en images; no pidas path ni URL.\n\nANTES de invocar, PREG\xDANTALE al usuario por price y offer si no los mencion\xF3 \u2014 son los inputs de mayor impacto en conversi\xF3n y nunca debes asumirlos. NO defaultes country/language desde el contexto: preg\xFAntale expl\xEDcitamente. Si el usuario te dice "t\xFA elige" para price/offer, om\xEDtelos.\n\nOTROS OPCIONALES (puedes invocar sin ellos y dejar que la IA elija defaults sensatos): durationSeconds (15 o 30), videoPreset (tipo/narrativa del video), features, cta, scriptNotes (dirige el guion Y el ambiente/escenario/est\xE9tica del video, ej. "en una playa, opulento").\n\nCOMPETENCIA Y GAP REPLICATION: con videoPreset="auto" (default) y competitorScanEnabled=true (default), el sistema analiza anuncios de competencia. Si encuentra un winner de video coherente, ancla el primaryAngle y genera autom\xE1ticamente la narrativa `gap_replication` para copiar su estructura audiovisual. No la selecciones manualmente: es un resultado del an\xE1lisis. Si competitorScanEnabled=false, esta b\xFAsqueda se omite.\n\nESTILO: 15s usa "Realista" (single_call); 30s usa "Multiescena" (multi-toma, aproximadamente 30s). Multiescena se factura por escena, as\xED que avisa el costo antes de activarlo.\n\nGUION: el usuario NO escribe el guion desde cero \u2014 la IA lo redacta. Si quiere REVISARLO/EDITARLO antes de renderizar (igual que en la web), pasa `pauseForVideoScriptReview: true`; cuando la tarea quede pausada, usa get_video_script para leer las escenas, ofr\xE9celas al usuario, y llama approve_video_script con las ediciones. Para dirigir el guion ANTES de generar (sin pausar), usa scriptNotes. Para revisar el \xE1ngulo y decidir duraci\xF3n tras el an\xE1lisis de competencia, pasa `pauseForAngleReview: true` y luego resuelve `angle_review_approval` con `gapDurationSeconds`.', VideoInput.shape, async (input) => {
11203
11241
  try {
11204
11242
  const resolved = resolveVideoPreset(input.videoPreset);
11205
11243
  const wireTier = resolveWireVideoTier(input.videoTier, input.durationSeconds);
@@ -11224,7 +11262,7 @@ function registerCreativeTools(server, api, { transport = "http" } = {}) {
11224
11262
  throw translateError(e);
11225
11263
  }
11226
11264
  });
11227
- server.tool("generate_image_creatives", 'Genera N variantes de imagen creativa (ads est\xE1ticos). Devuelve un taskId.\n\nREQUERIDOS: images (array de 1-5 fotos), productTitle, primaryAngle, language, country.\n\nANTES de invocar, PREG\xDANTALE al usuario:\n- price y offer (se renderizan en la imagen \u2014 nunca los asumas; si dice "t\xFA elige", om\xEDtelos).\n- compareAtPrice si hay descuento (ej. "$129.000" para tachar).\n- creativeArchetype y visualTreatment si quiere un look espec\xEDfico (performance vs premium DTC). Si no le importa, om\xEDtelos.\n\nNO defaultes country/language desde el contexto: preg\xFAntale expl\xEDcitamente.\n\nOTROS OPCIONALES: buyerPersona, nVariants (default 3), imageModel, imageStyle, styleMix, aspectRatio (default 4:5), generateAdCopy, pauseForAngleReview, features, brandColors, isCombo, creativeDirection.', ImageInput.shape, async (input) => {
11265
+ server.tool("generate_image_creatives", 'Genera N variantes de imagen creativa (ads est\xE1ticos). Devuelve un taskId.\n\nREQUERIDOS: images (array de 1-5 fotos), productTitle, primaryAngle, language, country. Si el usuario adjunta o menciona fotos locales y a\xFAn no hay assetId, llama primero `request_media_upload` con mediaKind=image y despu\xE9s usa los assetId en images; no pidas path ni URL.\n\nANTES de invocar, PREG\xDANTALE al usuario:\n- price y offer (se renderizan en la imagen \u2014 nunca los asumas; si dice "t\xFA elige", om\xEDtelos).\n- compareAtPrice si hay descuento (ej. "$129.000" para tachar).\n- creativeArchetype y visualTreatment si quiere un look espec\xEDfico (performance vs premium DTC). Si no le importa, om\xEDtelos.\n\nNO defaultes country/language desde el contexto: preg\xFAntale expl\xEDcitamente.\n\nOTROS OPCIONALES: buyerPersona, nVariants (default 3), imageModel, imageStyle, styleMix, aspectRatio (default 4:5), generateAdCopy, pauseForAngleReview, features, brandColors, isCombo, creativeDirection.', ImageInput.shape, async (input) => {
11228
11266
  try {
11229
11267
  const { projectId, ...rest } = input;
11230
11268
  return await submitCreative(api, {
@@ -11253,7 +11291,7 @@ function registerCreativeTools(server, api, { transport = "http" } = {}) {
11253
11291
  throw translateError(e);
11254
11292
  }
11255
11293
  });
11256
- server.tool("generate_landing", 'Genera una landing page cl\xE1sica basada en im\xE1genes, lista para Shopify. Devuelve un taskId.\n\nREQUERIDOS: images (array de 1-5 fotos), language, country.\n\nANTES de invocar, PREG\xDANTALE al usuario por price, offer y paymentMethods si no los mencion\xF3 \u2014 son los inputs de mayor impacto en conversi\xF3n y nunca debes asumirlos. Si hay descuento, pregunta tambi\xE9n compareAtPrice. NO defaultes country/language desde el contexto: preg\xFAntale expl\xEDcitamente. Si el usuario te dice "t\xFA elige" para esos campos, om\xEDtelos.\n\nOTROS OPCIONALES (puedes invocar sin ellos y dejar que la IA elija defaults): salesAngle, buyerPersona, isCombo, creativeDirection, landingStrategy.', LandingInput.shape, async (input) => {
11294
+ server.tool("generate_landing", 'Genera una landing page cl\xE1sica basada en im\xE1genes, lista para Shopify. Devuelve un taskId.\n\nREQUERIDOS: images (array de 1-5 fotos), language, country. Si el usuario dice algo natural como \u201Ccrea una landing con este producto\u201D y adjunta o menciona fotos locales, llama primero `request_media_upload` con mediaKind=image y despu\xE9s usa los assetId en images; no pidas path ni URL.\n\nANTES de invocar, PREG\xDANTALE al usuario por price, offer y paymentMethods si no los mencion\xF3 \u2014 son los inputs de mayor impacto en conversi\xF3n y nunca debes asumirlos. Si hay descuento, pregunta tambi\xE9n compareAtPrice. NO defaultes country/language desde el contexto: preg\xFAntale expl\xEDcitamente. Si el usuario te dice "t\xFA elige" para esos campos, om\xEDtelos.\n\nOTROS OPCIONALES (puedes invocar sin ellos y dejar que la IA elija defaults): salesAngle, buyerPersona, isCombo, creativeDirection, landingStrategy.', LandingInput.shape, async (input) => {
11257
11295
  try {
11258
11296
  const { projectId, ...rest } = input;
11259
11297
  return await submitCreative(api, {
@@ -11809,12 +11847,6 @@ var GroupedMediaSource = z53.object({
11809
11847
  }).refine((value) => !(value.thumbnailUrl && value.thumbnailPath), {
11810
11848
  message: "media source needs at most one of `thumbnailUrl` or `thumbnailPath`"
11811
11849
  });
11812
- var GroupedStagedMediaSource = z53.object({
11813
- type: z53.literal("staged"),
11814
- /** Legacy source returned by check_meta_media_upload. */
11815
- stagingAssetId: z53.string().uuid(),
11816
- thumbnailAssetId: z53.string().uuid().optional()
11817
- });
11818
11850
  var GroupedUploadedAssetSource = z53.object({
11819
11851
  type: z53.literal("asset"),
11820
11852
  /** Returned by check_media_upload. ProductMaker resolves ownership server-side. */
@@ -11829,7 +11861,6 @@ var GroupedCreative = z53.object({
11829
11861
  source: z53.union([
11830
11862
  GroupedTaskSource,
11831
11863
  GroupedMediaSource,
11832
- GroupedStagedMediaSource,
11833
11864
  GroupedUploadedAssetSource
11834
11865
  ]),
11835
11866
  title: z53.string().max(120).optional(),
@@ -12061,7 +12092,7 @@ function registerPublishTools(server, api, opts = {}) {
12061
12092
  throw translateError(e);
12062
12093
  }
12063
12094
  });
12064
- server.tool("publish_creatives_to_meta", "Crea UNA campa\xF1a de Meta Ads PAUSED agrupando hasta " + CAMPAIGN_LIMITS.MAX_CREATIVES + ' creativos. Antes llama `list_meta_destinations` y pide al usuario elegir el `portfolioId`, `adAccountId` y `pageId` exactos. Para archivos en una laptop con MCP remoto llama `request_media_upload`; tras OK usa cada resultado como `source.type="asset"` con su `assetId` y el `type` que coincide con `mediaKind`. No pidas path ni URL cuando el App est\xE1 disponible. `source.type="staged"` y `request_meta_media_upload` siguen aceptados solo por compatibilidad. Si la carga fue parcial, publica s\xF3lo los assets confirmados; nunca inventes assets ni superes diez creativos. Las rutas locales s\xF3lo funcionan con MCP stdio. Los medios propios se eliminan despu\xE9s de publicar correctamente; si falla, quedan durante el TTL para reintento. Para videos la miniatura es opcional y ProductMaker puede generarla con FFmpeg. `campaignConfig.destination` acepta landing o WhatsApp. Para landing basta `campaignConfig.destination.landingUrl`; no dupliques la URL arriba. Si omites `budgetMode`, se infiere `ad_set` cuando cada ad set trae `dailyBudget`, o `campaign` cuando env\xEDas `campaignDailyBudget`. No actives la campa\xF1a autom\xE1ticamente.', PublishCreativesToMetaInputBase.shape, async (rawInput) => {
12095
+ server.tool("publish_creatives_to_meta", "Crea UNA campa\xF1a de Meta Ads PAUSED agrupando hasta " + CAMPAIGN_LIMITS.MAX_CREATIVES + ' creativos. Si la petici\xF3n natural adjunta o menciona archivos locales, llama primero `request_media_upload`; tras OK usa cada resultado como `source.type="asset"` con su `assetId` y el `type` que coincide con `mediaKind`. No pidas path ni URL. Despu\xE9s llama `list_meta_destinations` y pregunta en el chat por el `portfolioId`, `adAccountId` y `pageId` exactos; el App es solo para archivos. Si la carga fue parcial, publica s\xF3lo los assets confirmados; nunca inventes assets ni superes diez creativos. Las rutas locales s\xF3lo funcionan con MCP stdio. Los medios propios se eliminan despu\xE9s de publicar correctamente; si falla, quedan durante el TTL para reintento. Para videos la miniatura es opcional y ProductMaker puede generarla con FFmpeg. `campaignConfig.destination` acepta landing o WhatsApp. Para landing basta `campaignConfig.destination.landingUrl`; no dupliques la URL arriba. Si omites `budgetMode`, se infiere `ad_set` cuando cada ad set trae `dailyBudget`, o `campaign` cuando env\xEDas `campaignDailyBudget`. No actives la campa\xF1a autom\xE1ticamente.', PublishCreativesToMetaInputBase.shape, async (rawInput) => {
12065
12096
  try {
12066
12097
  const parsed = PublishCreativesToMetaInput.safeParse(rawInput);
12067
12098
  if (!parsed.success) throw invalidInputFromZod(parsed.error);
@@ -12087,23 +12118,6 @@ function registerPublishTools(server, api, opts = {}) {
12087
12118
  });
12088
12119
  continue;
12089
12120
  }
12090
- if (creative.source.type === "staged") {
12091
- creatives.push({
12092
- type: creative.type,
12093
- source: {
12094
- type: "media",
12095
- mediaAssetId: creative.source.stagingAssetId,
12096
- ...creative.source.thumbnailAssetId ? {
12097
- thumbnailAssetId: creative.source.thumbnailAssetId
12098
- } : {}
12099
- },
12100
- title: creative.title,
12101
- description: creative.description,
12102
- cta: creative.cta,
12103
- creativeId
12104
- });
12105
- continue;
12106
- }
12107
12121
  if (creative.source.type === "asset") {
12108
12122
  creatives.push({
12109
12123
  type: creative.type,
@@ -12256,12 +12270,12 @@ __name(toTikTokCampaignConfig, "toTikTokCampaignConfig");
12256
12270
  // src/tools/meta-upload.ts
12257
12271
  import { registerAppTool } from "@modelcontextprotocol/ext-apps/server";
12258
12272
  import { z as z54 } from "zod";
12259
- var MetaUploadSessionInputBase = z54.object({
12273
+ var UploadSessionInputBase = z54.object({
12260
12274
  mediaKind: z54.enum([
12261
12275
  "image",
12262
12276
  "video",
12263
12277
  "mixed"
12264
- ]).default("mixed").describe("The kind of file the user will select in the upload page. Use mixed for a normal batch of image and video creatives."),
12278
+ ]).default("mixed").describe("The kind of file the user will select. Use image for product references and landing pages, video for a single video, and mixed only when the consumer supports both."),
12265
12279
  assetRole: z54.enum([
12266
12280
  "media",
12267
12281
  "thumbnail"
@@ -12274,18 +12288,18 @@ var OpenAiFileReference = z54.object({
12274
12288
  mime_type: z54.string().min(1).optional(),
12275
12289
  file_name: z54.string().min(1).optional()
12276
12290
  }).strict();
12277
- var MetaUploadSessionToolInputShape = {
12278
- ...MetaUploadSessionInputBase.shape,
12291
+ var UploadSessionToolInputShape = {
12292
+ ...UploadSessionInputBase.shape,
12279
12293
  files: z54.array(OpenAiFileReference).max(10).optional().describe("Optional OpenAI-hosted file references provided by ChatGPT. They are only metadata for the UI bridge and are never forwarded to ProductMaker.")
12280
12294
  };
12281
- var MetaUploadSessionToolInput = z54.object(MetaUploadSessionToolInputShape).superRefine((value, ctx) => {
12295
+ var UploadSessionToolInput = z54.object(UploadSessionToolInputShape).superRefine((value, ctx) => {
12282
12296
  if (value.assetRole === "thumbnail" && value.mediaKind !== "image") {
12283
12297
  ctx.addIssue({
12284
12298
  code: z54.ZodIssueCode.custom,
12285
12299
  path: [
12286
12300
  "mediaKind"
12287
12301
  ],
12288
- message: "Meta thumbnails must be images"
12302
+ message: "Thumbnails must be images"
12289
12303
  });
12290
12304
  }
12291
12305
  if (value.mediaKind === "video" && value.maxFiles !== void 0 && value.maxFiles !== 1) {
@@ -12307,7 +12321,7 @@ var MetaUploadSessionToolInput = z54.object(MetaUploadSessionToolInputShape).sup
12307
12321
  });
12308
12322
  }
12309
12323
  });
12310
- var MetaUploadSessionResponse2 = z54.object({
12324
+ var UploadSessionResponse = z54.object({
12311
12325
  sessionId: z54.string().uuid(),
12312
12326
  uploadPageUrl: z54.string().url(),
12313
12327
  mediaKind: z54.enum([
@@ -12322,23 +12336,8 @@ var MetaUploadSessionResponse2 = z54.object({
12322
12336
  maxFiles: z54.number().int().positive(),
12323
12337
  expiresAt: z54.string().datetime()
12324
12338
  });
12325
- var MetaUploadStatusInput = z54.object({
12326
- sessionId: z54.string().uuid().describe("The sessionId returned by request_meta_media_upload.")
12327
- });
12328
- var MetaUploadStatusResponse = z54.object({
12329
- sessionId: z54.string().uuid(),
12330
- status: z54.enum([
12331
- "pending",
12332
- "uploaded"
12333
- ]),
12334
- assets: z54.array(z54.object({
12335
- stagingAssetId: z54.string().uuid(),
12336
- mediaKind: z54.enum([
12337
- "image",
12338
- "video"
12339
- ])
12340
- })).max(10).default([]),
12341
- stagingAssetId: z54.string().uuid().optional()
12339
+ var UploadStatusInput = z54.object({
12340
+ sessionId: z54.string().uuid().describe("The sessionId returned by request_media_upload.")
12342
12341
  });
12343
12342
  var UniversalUploadStatusResponse = z54.discriminatedUnion("status", [
12344
12343
  z54.object({
@@ -12360,7 +12359,7 @@ var UniversalUploadStatusResponse = z54.discriminatedUnion("status", [
12360
12359
  })).min(1).max(10)
12361
12360
  })
12362
12361
  ]);
12363
- var UniversalUploadStructuredResponse = MetaUploadSessionResponse2.extend({
12362
+ var UniversalUploadStructuredResponse = UploadSessionResponse.extend({
12364
12363
  checkToolName: z54.literal("check_media_upload"),
12365
12364
  resolveEndpoint: z54.literal("/api/upload-media/resolve")
12366
12365
  });
@@ -12381,11 +12380,11 @@ function uploadSessionText(result) {
12381
12380
  };
12382
12381
  }
12383
12382
  __name(uploadSessionText, "uploadSessionText");
12384
- function registerMetaUploadTools(server, api) {
12383
+ function registerMediaUploadTools(server, api) {
12385
12384
  registerAppTool(server, "request_media_upload", {
12386
12385
  title: "Subir archivos",
12387
- description: "Abre el selector seguro y reutilizable de ProductMaker para im\xE1genes o videos de la laptop. Es la ruta preferida para todas las herramientas compatibles: create_product_task, generate_image_creatives, generate_video_creative, generate_free_video, generate_landing y publish_creatives_to_meta. En MCP remoto, si el usuario adjunta o menciona un archivo local, llama esta herramienta y no pidas una ruta local ni URL. Usa mediaKind=image para referencias de producto; no prometas usar un video donde el consumidor exige im\xE1genes. El usuario puede subir varios archivos y pulsa OK; el App contin\xFAa la petici\xF3n anterior usando \xFAnicamente asset IDs opacos y media kinds. Nunca muestres token, sessionId, URL temporal, bytes, base64 ni nombre privado del archivo. El enlace externo es fallback solo cuando el App inline no est\xE1 disponible o falla. Esta herramienta no genera, publica ni consume cr\xE9ditos.",
12388
- inputSchema: MetaUploadSessionToolInputShape,
12386
+ description: "Abre el selector universal de ProductMaker para im\xE1genes o videos del usuario. Ll\xE1malo autom\xE1ticamente cuando una petici\xF3n natural adjunte o mencione un archivo local, por ejemplo \u2018crea una landing con este producto\u2019, \u2018haz creativos con esta foto\u2019 o \u2018sube este video a Meta\u2019; no pidas una ruta local ni URL. Es la \xFAnica ruta de carga para create_product_task, generate_image_creatives, generate_video_creative, generate_free_video, generate_landing y publish_creatives_to_meta. Pasa las referencias opcionales de ChatGPT en files; si el host no puede transferirlas, el mismo App muestra el selector inline. Usa mediaKind=image para referencias de producto y landings; mixed solo cuando el consumidor acepte ambos tipos. Tras OK, reanuda la intenci\xF3n original usando \xFAnicamente assetId y mediaKind, sin pedir que vuelva a subir ni mostrar datos t\xE9cnicos. El enlace externo es fallback solo si el App inline falla. Esta herramienta no genera, publica ni consume cr\xE9ditos.",
12387
+ inputSchema: UploadSessionToolInputShape,
12389
12388
  outputSchema: UniversalUploadStructuredResponse.shape,
12390
12389
  _meta: {
12391
12390
  ui: {
@@ -12405,9 +12404,9 @@ function registerMetaUploadTools(server, api) {
12405
12404
  }
12406
12405
  }, async (rawInput) => {
12407
12406
  try {
12408
- const input = MetaUploadSessionToolInput.parse(rawInput);
12407
+ const input = UploadSessionToolInput.parse(rawInput);
12409
12408
  const { files: _files, ...sessionInput } = input;
12410
- const session = MetaUploadSessionResponse2.parse(await api.postJson("/v1/uploaded-assets/sessions", sessionInput));
12409
+ const session = UploadSessionResponse.parse(await api.postJson("/v1/uploaded-assets/sessions", sessionInput));
12411
12410
  const result = UniversalUploadStructuredResponse.parse({
12412
12411
  ...session,
12413
12412
  checkToolName: "check_media_upload",
@@ -12423,69 +12422,20 @@ function registerMetaUploadTools(server, api) {
12423
12422
  });
12424
12423
  server.registerTool("check_media_upload", {
12425
12424
  description: "Comprueba la carga universal. Si status=uploaded, conserva assets[] para la petici\xF3n anterior y pasa cada assetId \xFAnicamente a un consumidor compatible. Un asset de video solo sirve donde se admite video; las referencias de producto, imagen y landing requieren mediaKind=image. No muestres IDs t\xE9cnicos como JSON al usuario.",
12426
- inputSchema: MetaUploadStatusInput.shape,
12425
+ inputSchema: UploadStatusInput.shape,
12427
12426
  _meta: {
12428
12427
  "openai/widgetAccessible": true
12429
12428
  }
12430
12429
  }, async (rawInput) => {
12431
12430
  try {
12432
- const input = MetaUploadStatusInput.parse(rawInput);
12431
+ const input = UploadStatusInput.parse(rawInput);
12433
12432
  return asText(UniversalUploadStatusResponse.parse(await api.getJson(`/v1/uploaded-assets/sessions/${encodeURIComponent(input.sessionId)}`)));
12434
12433
  } catch (error) {
12435
12434
  throw translateError(error);
12436
12435
  }
12437
12436
  });
12438
- registerAppTool(server, "request_meta_media_upload", {
12439
- title: "Solicitar carga segura de Meta",
12440
- description: "Inicia una carga segura desde la laptop del usuario para creativos propios de Meta. Esta es la ruta DIRECTA para peticiones puntuales como \u2018sube esta imagen/video a Meta Ads\u2019 o \u2018publica este creativo\u2019; no conviertas esa intenci\xF3n en una generaci\xF3n completa de producto. No llames `guide_dropshipping_launch` para esta operaci\xF3n puntual. Por defecto crea una sesi\xF3n `mixed` de hasta diez archivos; tambi\xE9n admite una sola imagen o video. Si el usuario adjunta una foto o video en el mismo mensaje de ChatGPT, pasa esas referencias opcionales en `files` para que el MCP App inline las consuma dentro del chat. ProductMaker conserva `files` solo como metadata del UI bridge: NO los descarga y NO los reenv\xEDa. No pidas URL CDN, ruta local, bytes ni base64. El App es exclusivamente para cargar archivos: nunca debe pedir ni mostrar portafolio, cuenta publicitaria, p\xE1gina, IDs o JSON. El enlace externo de ProductMaker queda como fallback para hosts sin bridge de archivos. El usuario pulsa OK cuando termina; el App inserta en el chat los asset_id verificados para continuar la petici\xF3n anterior. Luego llama `list_meta_destinations` y pregunta en el chat qu\xE9 `portfolioId`, `adAccountId` y `pageId` desea usar. No muestres tokens, URLs temporales, `sessionId` ni un bloque JSON. Esta herramienta no publica ni consume cr\xE9ditos.",
12441
- inputSchema: MetaUploadSessionToolInputShape,
12442
- outputSchema: MetaUploadSessionResponse2.shape,
12443
- _meta: {
12444
- ui: {
12445
- resourceUri: META_UPLOAD_APP_RESOURCE_URI,
12446
- visibility: [
12447
- "model",
12448
- "app"
12449
- ]
12450
- },
12451
- "openai/outputTemplate": META_UPLOAD_APP_RESOURCE_URI,
12452
- "openai/widgetAccessible": true,
12453
- "openai/fileParams": [
12454
- "files"
12455
- ],
12456
- "openai/toolInvocation/invoking": "Preparando carga segura\u2026",
12457
- "openai/toolInvocation/invoked": "Carga segura lista"
12458
- }
12459
- }, async (rawInput) => {
12460
- try {
12461
- const input = MetaUploadSessionToolInput.parse(rawInput);
12462
- const { files: _files, ...sessionInput } = input;
12463
- const result = MetaUploadSessionResponse2.parse(await api.postJson("/v1/ads/meta-upload-sessions", sessionInput));
12464
- return {
12465
- structuredContent: result,
12466
- ...uploadSessionText(result)
12467
- };
12468
- } catch (error) {
12469
- throw translateError(error);
12470
- }
12471
- });
12472
- server.registerTool("check_meta_media_upload", {
12473
- description: 'Comprueba si el usuario ya termin\xF3 de subir desde el App o enlace de ProductMaker. Si status=uploaded, conserva `assets[]` privadamente, llama `list_meta_destinations` y pregunta en lenguaje natural dentro del chat qu\xE9 portafolio, cuenta publicitaria y p\xE1gina desea usar; nunca muestres `sessionId`, `stagingAssetId`, IDs t\xE9cnicos ni un bloque JSON. Despu\xE9s crea un creativo `source.type="staged"` por cada asset, usando su `mediaKind` como tipo, hasta diez en el batch. Si la carga fue parcial, usa \xFAnicamente los assets confirmados. Conserva el `stagingAssetId` legado si aparece. Si status=pending, pide al usuario que termine; no publiques todav\xEDa.',
12474
- inputSchema: MetaUploadStatusInput.shape,
12475
- _meta: {
12476
- "openai/widgetAccessible": true
12477
- }
12478
- }, async (rawInput) => {
12479
- try {
12480
- const input = MetaUploadStatusInput.parse(rawInput);
12481
- const result = MetaUploadStatusResponse.parse(await api.getJson(`/v1/ads/meta-upload-sessions/${encodeURIComponent(input.sessionId)}`));
12482
- return asText(result);
12483
- } catch (error) {
12484
- throw translateError(error);
12485
- }
12486
- });
12487
12437
  }
12488
- __name(registerMetaUploadTools, "registerMetaUploadTools");
12438
+ __name(registerMediaUploadTools, "registerMediaUploadTools");
12489
12439
 
12490
12440
  // src/tools/campaigns.ts
12491
12441
  import { z as z55 } from "zod";
@@ -13528,13 +13478,13 @@ function registerDropshippingProjectTools(server, api) {
13528
13478
  throw translateError(error);
13529
13479
  }
13530
13480
  });
13531
- server.tool("guide_dropshipping_launch", "Gu\xEDa read-only de un recorrido COMPLETO de dropshipping, desde producto/costeo hasta creativos, tienda y publicidad. No uses este tool para subir o publicar un creativo puntual en Meta: llama directamente `request_meta_media_upload`, `list_meta_destinations` y `publish_creatives_to_meta`. Sin projectId explica cu\xE1ndo usar un flujo directo versus uno guiado; con projectId devuelve la fase y la \xFAnica nextAction calculada por ProductMaker. Despu\xE9s de cada mutaci\xF3n vuelve a llamar este tool o lee el proyecto. Nunca activa Meta.", GuideInput.shape, async (input) => {
13481
+ server.tool("guide_dropshipping_launch", "Gu\xEDa read-only de un recorrido COMPLETO de dropshipping, desde producto/costeo hasta creativos, tienda y publicidad. No uses este tool para subir o publicar un creativo puntual en Meta: llama directamente `request_media_upload`, `list_meta_destinations` y `publish_creatives_to_meta`. Sin projectId explica cu\xE1ndo usar un flujo directo versus uno guiado; con projectId devuelve la fase y la \xFAnica nextAction calculada por ProductMaker. Despu\xE9s de cada mutaci\xF3n vuelve a llamar este tool o lee el proyecto. Nunca activa Meta.", GuideInput.shape, async (input) => {
13532
13482
  try {
13533
13483
  if (!input.projectId) {
13534
13484
  return asText({
13535
13485
  mode: "choose",
13536
13486
  guided: "Usa start_dropshipping_project cuando el usuario quiera encontrar un producto y dejarlo listo para publicar.",
13537
- direct: "En modo directo usa la herramienta puntual. Para subir/publicar un creativo propio en Meta: request_meta_media_upload \u2192 list_meta_destinations \u2192 publish_creatives_to_meta. No crees un proyecto guiado.",
13487
+ direct: "En modo directo usa la herramienta puntual. Para subir/publicar un creativo propio en Meta: request_media_upload \u2192 list_meta_destinations \u2192 publish_creatives_to_meta. No crees un proyecto guiado.",
13538
13488
  confirmation: "Antes de acciones pagadas o externas, muestra el estimado y pide confirmaci\xF3n.",
13539
13489
  safety: "Las campa\xF1as Meta quedan PAUSED; el usuario las activa manualmente en Ads Manager."
13540
13490
  });
@@ -13551,6 +13501,9 @@ __name(registerDropshippingProjectTools, "registerDropshippingProjectTools");
13551
13501
  var START_DROPSHIPPING_PROMPT_NAME = "start_dropshipping";
13552
13502
  var PRODUCTMAKER_SERVER_INSTRUCTIONS = [
13553
13503
  "Understand the user's intent before choosing a ProductMaker tool.",
13504
+ "When a ProductMaker request needs an image or video the user attached, pasted, or has locally and no reusable ProductMaker assetId is already available, call request_media_upload immediately. Treat natural requests such as 'create a landing with this product', 'make creatives with this photo', or 'upload this video to Meta' as upload intent; never require the user to name the uploader.",
13505
+ "For remote MCP hosts, never ask for a local path, CDN URL, bytes, or base64. Pass supported host file references to request_media_upload; otherwise let its inline App open the file picker. The external upload page is fallback only.",
13506
+ "After the upload App sends its OK continuation, resume the original request with the verified assetId values, do not ask for another upload, and ask only for remaining business inputs in chat. The host-inserted continuation may contain opaque asset IDs; do not repeat them in narrative prose or expose session IDs, tokens, private URLs, file names, or JSON handoff payloads.",
13554
13507
  "Keep focused requests direct: creatives, landing pages, Shopify publication, Meta publication, and status checks do not require a DropshippingProject.",
13555
13508
  "Use the guided journey only for an explicit end-to-end launch.",
13556
13509
  "In guided mode, create a project only after a product is chosen, then call guide_dropshipping_launch after every mutation and follow its nextAction.",
@@ -13615,7 +13568,7 @@ function createServer(opts) {
13615
13568
  });
13616
13569
  const api = new ApiClient(apiBaseUrl, apiKey);
13617
13570
  registerProductMakerPrompts(server);
13618
- registerMetaUploadAppResource(server);
13571
+ registerMediaUploadAppResource(server);
13619
13572
  registerProductCostingTools(server);
13620
13573
  registerProductResearchTools(server, api);
13621
13574
  registerDropshippingProjectTools(server, api);
@@ -13633,7 +13586,7 @@ function createServer(opts) {
13633
13586
  registerPublishTools(server, api, {
13634
13587
  transport
13635
13588
  });
13636
- registerMetaUploadTools(server, api);
13589
+ registerMediaUploadTools(server, api);
13637
13590
  registerCampaignTools(server, api);
13638
13591
  return server;
13639
13592
  }