@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/README.md +7 -15
- package/dist/http.js +145 -192
- package/dist/stdio.js +145 -192
- package/dist/ui/meta-upload-app.html +17 -74
- package/package.json +3 -3
package/dist/http.js
CHANGED
|
@@ -157,16 +157,15 @@ var ApiClient = class {
|
|
|
157
157
|
};
|
|
158
158
|
|
|
159
159
|
// src/index.ts
|
|
160
|
-
var MCP_VERSION = "
|
|
160
|
+
var MCP_VERSION = "3.0.0";
|
|
161
161
|
|
|
162
162
|
// src/meta-upload-app.ts
|
|
163
163
|
import { readFileSync } from "fs";
|
|
164
164
|
import { registerAppResource, RESOURCE_MIME_TYPE } from "@modelcontextprotocol/ext-apps/server";
|
|
165
|
-
var META_UPLOAD_APP_RESOURCE_URI = "ui://meta-upload/v1.html";
|
|
166
165
|
var MEDIA_UPLOAD_APP_RESOURCE_URI = "ui://media-upload/v1.html";
|
|
167
|
-
var
|
|
168
|
-
var
|
|
169
|
-
var
|
|
166
|
+
var MEDIA_UPLOAD_APP_NAME = "ProductMaker media upload";
|
|
167
|
+
var MEDIA_UPLOAD_APP_HTML_URL = new URL("./ui/meta-upload-app.html", import.meta.url);
|
|
168
|
+
var MEDIA_UPLOAD_APP_CSP = {
|
|
170
169
|
connectDomains: [
|
|
171
170
|
"https://productmaker.app",
|
|
172
171
|
"https://www.productmaker.app",
|
|
@@ -174,46 +173,41 @@ var META_UPLOAD_APP_CSP = {
|
|
|
174
173
|
"https://*.oaiusercontent.com"
|
|
175
174
|
]
|
|
176
175
|
};
|
|
177
|
-
function
|
|
176
|
+
function readMediaUploadAppHtml(htmlUrl = MEDIA_UPLOAD_APP_HTML_URL) {
|
|
178
177
|
try {
|
|
179
178
|
return readFileSync(htmlUrl, "utf8");
|
|
180
179
|
} catch (error) {
|
|
181
180
|
const message = error instanceof Error ? error.message : String(error);
|
|
182
|
-
throw new Error(`Missing packaged
|
|
181
|
+
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}`);
|
|
183
182
|
}
|
|
184
183
|
}
|
|
185
|
-
__name(
|
|
186
|
-
function
|
|
187
|
-
const html =
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
mimeType: RESOURCE_MIME_TYPE,
|
|
195
|
-
_meta: {
|
|
196
|
-
ui: {
|
|
197
|
-
csp: META_UPLOAD_APP_CSP
|
|
198
|
-
}
|
|
184
|
+
__name(readMediaUploadAppHtml, "readMediaUploadAppHtml");
|
|
185
|
+
function registerMediaUploadAppResource(server) {
|
|
186
|
+
const html = readMediaUploadAppHtml();
|
|
187
|
+
registerAppResource(server, MEDIA_UPLOAD_APP_NAME, MEDIA_UPLOAD_APP_RESOURCE_URI, {
|
|
188
|
+
title: "Upload media",
|
|
189
|
+
mimeType: RESOURCE_MIME_TYPE,
|
|
190
|
+
_meta: {
|
|
191
|
+
ui: {
|
|
192
|
+
csp: MEDIA_UPLOAD_APP_CSP
|
|
199
193
|
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
194
|
+
}
|
|
195
|
+
}, async () => ({
|
|
196
|
+
contents: [
|
|
197
|
+
{
|
|
198
|
+
uri: MEDIA_UPLOAD_APP_RESOURCE_URI,
|
|
199
|
+
mimeType: RESOURCE_MIME_TYPE,
|
|
200
|
+
text: html,
|
|
201
|
+
_meta: {
|
|
202
|
+
ui: {
|
|
203
|
+
csp: MEDIA_UPLOAD_APP_CSP
|
|
210
204
|
}
|
|
211
205
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
}));
|
|
215
209
|
}
|
|
216
|
-
__name(
|
|
210
|
+
__name(registerMediaUploadAppResource, "registerMediaUploadAppResource");
|
|
217
211
|
|
|
218
212
|
// src/tools/tasks.ts
|
|
219
213
|
import { z as z47 } from "zod";
|
|
@@ -4911,46 +4905,47 @@ var DEFAULT_PRICING = {
|
|
|
4911
4905
|
},
|
|
4912
4906
|
// Grok Imagine I2V pricing by duration/resolution (grok-imagine/image-to-video).
|
|
4913
4907
|
// Provider unified ALL grok-imagine-1.5 renders (silent multi-clip AND native-audio
|
|
4914
|
-
// single-call) onto ONE per-second rate on 2026-06-22
|
|
4915
|
-
//
|
|
4908
|
+
// single-call) onto ONE per-second rate on 2026-06-22 (then $0.008/s @ 480p,
|
|
4909
|
+
// $0.015/s @ 720p). Provider RAISED that unified rate on 2026-08-06 to
|
|
4910
|
+
// $0.012/s @ 480p and $0.0225/s @ 720p (+50%) — the rates below.
|
|
4916
4911
|
// Flat duration keys below = perSecondRate × seconds; userPrice = GROK_USER_MARKUP × cost.
|
|
4917
4912
|
//
|
|
4918
|
-
//
|
|
4919
|
-
//
|
|
4913
|
+
// Grok bills at GROK_USER_MARKUP, which is the 2× house rate again since
|
|
4914
|
+
// 2026-08-06 (the 2.5× exception was reverted — see that constant above).
|
|
4920
4915
|
"kie:video-generation:grok-6s-480p": {
|
|
4921
|
-
ourCostCents:
|
|
4922
|
-
userPriceCents:
|
|
4916
|
+
ourCostCents: 7.2,
|
|
4917
|
+
userPriceCents: 14.4
|
|
4923
4918
|
},
|
|
4924
4919
|
"kie:video-generation:grok-6s-720p": {
|
|
4925
|
-
ourCostCents:
|
|
4926
|
-
userPriceCents:
|
|
4920
|
+
ourCostCents: 13.5,
|
|
4921
|
+
userPriceCents: 27
|
|
4927
4922
|
},
|
|
4928
4923
|
"kie:video-generation:grok-10s-480p": {
|
|
4929
|
-
ourCostCents:
|
|
4930
|
-
userPriceCents:
|
|
4924
|
+
ourCostCents: 12,
|
|
4925
|
+
userPriceCents: 24
|
|
4931
4926
|
},
|
|
4932
4927
|
"kie:video-generation:grok-10s-720p": {
|
|
4933
|
-
ourCostCents:
|
|
4934
|
-
userPriceCents:
|
|
4928
|
+
ourCostCents: 22.5,
|
|
4929
|
+
userPriceCents: 45
|
|
4935
4930
|
},
|
|
4936
4931
|
"kie:video-generation:grok-15s-480p": {
|
|
4937
|
-
ourCostCents:
|
|
4938
|
-
userPriceCents:
|
|
4932
|
+
ourCostCents: 18,
|
|
4933
|
+
userPriceCents: 36
|
|
4939
4934
|
},
|
|
4940
4935
|
"kie:video-generation:grok-15s-720p": {
|
|
4941
|
-
ourCostCents:
|
|
4942
|
-
userPriceCents:
|
|
4936
|
+
ourCostCents: 33.75,
|
|
4937
|
+
userPriceCents: 67.5
|
|
4943
4938
|
},
|
|
4944
4939
|
// Grok Imagine Video 1.5 PER-SECOND (rapid/standard multi-clip path; SAME unified
|
|
4945
|
-
// $/s as the flat keys above: $0.
|
|
4940
|
+
// $/s as the flat keys above: $0.012/s 480p, $0.0225/s 720p). Billed units = perClipSeconds.
|
|
4946
4941
|
// userPrice must stay flat_key ÷ 15 so a 15s render costs the same on either path.
|
|
4947
4942
|
"kie:video-generation:grok15-persec-480p": {
|
|
4948
|
-
ourCostCents:
|
|
4949
|
-
userPriceCents: 2
|
|
4943
|
+
ourCostCents: 1.2,
|
|
4944
|
+
userPriceCents: 2.4
|
|
4950
4945
|
},
|
|
4951
4946
|
"kie:video-generation:grok15-persec-720p": {
|
|
4952
|
-
ourCostCents:
|
|
4953
|
-
userPriceCents:
|
|
4947
|
+
ourCostCents: 2.25,
|
|
4948
|
+
userPriceCents: 4.5
|
|
4954
4949
|
},
|
|
4955
4950
|
// Free-video subtitle burn: one final Whisper transcription per rendered second.
|
|
4956
4951
|
// The worker uses this exact action with units=Math.ceil(finalAudioDuration).
|
|
@@ -5001,11 +4996,11 @@ var DEFAULT_PRICING = {
|
|
|
5001
4996
|
// rate (same as kie: key above); ourCost = real Fal cost (we absorb the premium on rare failover).
|
|
5002
4997
|
"fal:video-generation:grok-15s-480p": {
|
|
5003
4998
|
ourCostCents: 121,
|
|
5004
|
-
userPriceCents:
|
|
4999
|
+
userPriceCents: 36
|
|
5005
5000
|
},
|
|
5006
5001
|
"fal:video-generation:grok-15s-720p": {
|
|
5007
5002
|
ourCostCents: 211,
|
|
5008
|
-
userPriceCents:
|
|
5003
|
+
userPriceCents: 67.5
|
|
5009
5004
|
},
|
|
5010
5005
|
// Fal Grok Imagine 1.5 PER-SECOND failover pricing (rapid/STANDARD multi-clip path —
|
|
5011
5006
|
// mirrors kie:video-generation:grok15-persec-* above, SAME $0.08/s (480p) / $0.14/s
|
|
@@ -5015,11 +5010,11 @@ var DEFAULT_PRICING = {
|
|
|
5015
5010
|
// .superpowers/sdd/fal-grok-rapid-brief.md.
|
|
5016
5011
|
"fal:video-generation:grok15-persec-480p": {
|
|
5017
5012
|
ourCostCents: 8,
|
|
5018
|
-
userPriceCents: 2
|
|
5013
|
+
userPriceCents: 2.4
|
|
5019
5014
|
},
|
|
5020
5015
|
"fal:video-generation:grok15-persec-720p": {
|
|
5021
5016
|
ourCostCents: 14,
|
|
5022
|
-
userPriceCents:
|
|
5017
|
+
userPriceCents: 4.5
|
|
5023
5018
|
},
|
|
5024
5019
|
"kie:video-generation:wan": {
|
|
5025
5020
|
ourCostCents: 30,
|
|
@@ -5886,18 +5881,18 @@ var DEFAULT_PRICING = {
|
|
|
5886
5881
|
},
|
|
5887
5882
|
// ─── Video Regenerate pricing keys ────────────────────────────────────────
|
|
5888
5883
|
// Billed by priceVideoRegenerateSection() below; keys kept for audit trail.
|
|
5889
|
-
// multi_shot: one grok i2v clip per scene (~3s @ 480p:
|
|
5890
|
-
// single_call: one 15s native-audio grok-1.5 whole-video render (
|
|
5884
|
+
// multi_shot: one grok i2v clip per scene (~3s @ 480p: 1.2¢/s × 3s = 3.6¢ our / 7.2¢ user)
|
|
5885
|
+
// single_call: one 15s native-audio grok-1.5 whole-video render (18¢ our / 36¢ user)
|
|
5891
5886
|
// Both are grok renders, so both carry GROK_USER_MARKUP — and both match what the
|
|
5892
|
-
// initial-render keys charge for the identical clip (grok15-persec-480p × 3s =
|
|
5893
|
-
// grok-15s-480p =
|
|
5887
|
+
// initial-render keys charge for the identical clip (grok15-persec-480p × 3s = 7.2¢;
|
|
5888
|
+
// grok-15s-480p = 36¢).
|
|
5894
5889
|
"kie:video-regen:multi_shot-per-scene": {
|
|
5895
|
-
ourCostCents:
|
|
5896
|
-
userPriceCents:
|
|
5890
|
+
ourCostCents: 3.6,
|
|
5891
|
+
userPriceCents: 7.2
|
|
5897
5892
|
},
|
|
5898
5893
|
"kie:video-regen:single_call": {
|
|
5899
|
-
ourCostCents:
|
|
5900
|
-
userPriceCents:
|
|
5894
|
+
ourCostCents: 18,
|
|
5895
|
+
userPriceCents: 36
|
|
5901
5896
|
},
|
|
5902
5897
|
// ─── Competitor Video Transcripts (OpenAI Whisper) ────────────────────────
|
|
5903
5898
|
// Unit = one successfully transcribed video ad opening (~8s of audio).
|
|
@@ -8071,11 +8066,19 @@ var ServiceMediaAnalysisSchema = z43.object({
|
|
|
8071
8066
|
});
|
|
8072
8067
|
|
|
8073
8068
|
// ../../packages/types/src/productmaker-capability-registry.ts
|
|
8074
|
-
var
|
|
8069
|
+
var SHARED_CHANNEL_EXPOSURE = {
|
|
8070
|
+
mcp: "direct",
|
|
8071
|
+
whatsapp: "adapted"
|
|
8072
|
+
};
|
|
8073
|
+
var MCP_ONLY_CHANNEL_EXPOSURE = {
|
|
8075
8074
|
mcp: "direct",
|
|
8075
|
+
whatsapp: "unavailable"
|
|
8076
|
+
};
|
|
8077
|
+
var WHATSAPP_ONLY_CHANNEL_EXPOSURE = {
|
|
8078
|
+
mcp: "unavailable",
|
|
8076
8079
|
whatsapp: "adapted"
|
|
8077
8080
|
};
|
|
8078
|
-
function defineCapability(name, schemaHash, confirmation, routingDomain, effects, inputSlots, consumes, produces) {
|
|
8081
|
+
function defineCapability(name, schemaHash, confirmation, routingDomain, effects, inputSlots, consumes, produces, channelExposure = SHARED_CHANNEL_EXPOSURE) {
|
|
8079
8082
|
return {
|
|
8080
8083
|
name,
|
|
8081
8084
|
schemaHash,
|
|
@@ -8087,7 +8090,7 @@ function defineCapability(name, schemaHash, confirmation, routingDomain, effects
|
|
|
8087
8090
|
consumes,
|
|
8088
8091
|
produces
|
|
8089
8092
|
},
|
|
8090
|
-
channelExposure
|
|
8093
|
+
channelExposure
|
|
8091
8094
|
};
|
|
8092
8095
|
}
|
|
8093
8096
|
__name(defineCapability, "defineCapability");
|
|
@@ -8171,7 +8174,18 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
|
|
|
8171
8174
|
"meta_upload_session"
|
|
8172
8175
|
], [
|
|
8173
8176
|
"staging_asset"
|
|
8174
|
-
]),
|
|
8177
|
+
], WHATSAPP_ONLY_CHANNEL_EXPOSURE),
|
|
8178
|
+
defineCapability("check_media_upload", "daf202e0ff3a7a14425d164a7be6a81922b12233e85dbb898894e7c3ba6c5876", "none", "read_only", [
|
|
8179
|
+
"read"
|
|
8180
|
+
], [
|
|
8181
|
+
slot("upload_session", true, [
|
|
8182
|
+
"sessionId"
|
|
8183
|
+
], [])
|
|
8184
|
+
], [
|
|
8185
|
+
"media_upload_session"
|
|
8186
|
+
], [
|
|
8187
|
+
"uploaded_asset"
|
|
8188
|
+
], MCP_ONLY_CHANNEL_EXPOSURE),
|
|
8175
8189
|
defineCapability("cost_dropshipping_project", "746797b5400b170ba3a0704d432afff635794f0a7ae0b9da07b26d49e3b82242", "state_change", "business", [
|
|
8176
8190
|
"state_change"
|
|
8177
8191
|
], [
|
|
@@ -8452,7 +8466,7 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
|
|
|
8452
8466
|
], [
|
|
8453
8467
|
"product_research_run"
|
|
8454
8468
|
]),
|
|
8455
|
-
defineCapability("generate_free_video", "
|
|
8469
|
+
defineCapability("generate_free_video", "01f5e412c4ae3a8e1d97ded33f5cf38c4505f02fcf301dad90c37655c8de783f", "credit_consuming", "creative", [
|
|
8456
8470
|
"credit_consuming",
|
|
8457
8471
|
"state_change"
|
|
8458
8472
|
], [
|
|
@@ -8793,7 +8807,7 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
|
|
|
8793
8807
|
], [
|
|
8794
8808
|
"tiktok_advertiser"
|
|
8795
8809
|
]),
|
|
8796
|
-
defineCapability("publish_creatives_to_meta", "
|
|
8810
|
+
defineCapability("publish_creatives_to_meta", "b3a487134a1f5392d7a526348a03e952a317ae5d9ff01bae10bbe24ec5fe3fc8", "external_mutation", "publishing", [
|
|
8797
8811
|
"external_mutation",
|
|
8798
8812
|
"state_change"
|
|
8799
8813
|
], [
|
|
@@ -8962,7 +8976,27 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
|
|
|
8962
8976
|
"media_upload_request"
|
|
8963
8977
|
], [
|
|
8964
8978
|
"meta_upload_session"
|
|
8965
|
-
]),
|
|
8979
|
+
], WHATSAPP_ONLY_CHANNEL_EXPOSURE),
|
|
8980
|
+
defineCapability("request_media_upload", "794e9b279b49d0e818423fa4ae9f1a4a52689620abc3520380d7e86a3630380f", "none", "creative", [
|
|
8981
|
+
"state_change"
|
|
8982
|
+
], [
|
|
8983
|
+
slot("media_kind", true, [
|
|
8984
|
+
"mediaKind"
|
|
8985
|
+
], []),
|
|
8986
|
+
slot("asset_role", false, [
|
|
8987
|
+
"assetRole"
|
|
8988
|
+
], []),
|
|
8989
|
+
slot("file_limit", false, [
|
|
8990
|
+
"maxFiles"
|
|
8991
|
+
], []),
|
|
8992
|
+
slot("host_files", false, [
|
|
8993
|
+
"files"
|
|
8994
|
+
], [])
|
|
8995
|
+
], [
|
|
8996
|
+
"media_upload_request"
|
|
8997
|
+
], [
|
|
8998
|
+
"media_upload_session"
|
|
8999
|
+
], MCP_ONLY_CHANNEL_EXPOSURE),
|
|
8966
9000
|
defineCapability("resolve_pending_action", "2fae350d14ba3fdab63914ca3b442472a002d97cffc85b6f207b1cc7e320ecdb", "credit_consuming", "creative", [
|
|
8967
9001
|
"credit_consuming",
|
|
8968
9002
|
"state_change"
|
|
@@ -9020,6 +9054,9 @@ var PRODUCTMAKER_CAPABILITY_REGISTRY = deepFreeze([
|
|
|
9020
9054
|
])
|
|
9021
9055
|
]);
|
|
9022
9056
|
var PRODUCTMAKER_CAPABILITY_NAMES = PRODUCTMAKER_CAPABILITY_REGISTRY.map((capability) => capability.name);
|
|
9057
|
+
var PRODUCTMAKER_MCP_CAPABILITY_REGISTRY = PRODUCTMAKER_CAPABILITY_REGISTRY.filter((capability) => capability.channelExposure.mcp === "direct");
|
|
9058
|
+
var PRODUCTMAKER_WHATSAPP_CAPABILITY_REGISTRY = PRODUCTMAKER_CAPABILITY_REGISTRY.filter((capability) => capability.channelExposure.whatsapp === "adapted");
|
|
9059
|
+
var PRODUCTMAKER_WHATSAPP_CAPABILITY_NAMES = PRODUCTMAKER_WHATSAPP_CAPABILITY_REGISTRY.map((capability) => capability.name);
|
|
9023
9060
|
|
|
9024
9061
|
// ../../packages/types/src/productmaker-chat-capabilities.ts
|
|
9025
9062
|
function toLegacyCapabilityCatalog(catalog) {
|
|
@@ -9030,7 +9067,8 @@ function toLegacyCapabilityCatalog(catalog) {
|
|
|
9030
9067
|
}));
|
|
9031
9068
|
}
|
|
9032
9069
|
__name(toLegacyCapabilityCatalog, "toLegacyCapabilityCatalog");
|
|
9033
|
-
var PRODUCTMAKER_MCP_CAPABILITIES = toLegacyCapabilityCatalog(
|
|
9070
|
+
var PRODUCTMAKER_MCP_CAPABILITIES = toLegacyCapabilityCatalog(PRODUCTMAKER_MCP_CAPABILITY_REGISTRY);
|
|
9071
|
+
var PRODUCTMAKER_MCP_CAPABILITY_NAMES = PRODUCTMAKER_MCP_CAPABILITY_REGISTRY.map((capability) => capability.name);
|
|
9034
9072
|
|
|
9035
9073
|
// ../../packages/types/src/actor.ts
|
|
9036
9074
|
import { z as z44 } from "zod";
|
|
@@ -11141,7 +11179,7 @@ var FREE_VIDEO_DURATIONS_BY_QUALITY = {
|
|
|
11141
11179
|
]
|
|
11142
11180
|
};
|
|
11143
11181
|
var FreeVideoInput = z48.object({
|
|
11144
|
-
images: ImagesInput.optional().describe("Opcional. 1-5 fotos del producto. Om\xEDtelo para generar desde texto puro."),
|
|
11182
|
+
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."),
|
|
11145
11183
|
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."),
|
|
11146
11184
|
quality: FreeVideoQualityEnum.describe('Calidad del video: "economical" = Econ\xF3mico o "high_detail" = Alto detalle.'),
|
|
11147
11185
|
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."),
|
|
@@ -11213,7 +11251,7 @@ var LandingInput = z48.object({
|
|
|
11213
11251
|
subheadline: CreativeRefs.subheadline
|
|
11214
11252
|
});
|
|
11215
11253
|
function registerCreativeTools(server, api, { transport = "http" } = {}) {
|
|
11216
|
-
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) => {
|
|
11254
|
+
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) => {
|
|
11217
11255
|
try {
|
|
11218
11256
|
const allowedDurations = FREE_VIDEO_DURATIONS_BY_QUALITY[input.quality];
|
|
11219
11257
|
if (!allowedDurations.includes(input.durationSeconds)) {
|
|
@@ -11243,7 +11281,7 @@ function registerCreativeTools(server, api, { transport = "http" } = {}) {
|
|
|
11243
11281
|
throw translateError(e);
|
|
11244
11282
|
}
|
|
11245
11283
|
});
|
|
11246
|
-
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) => {
|
|
11284
|
+
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) => {
|
|
11247
11285
|
try {
|
|
11248
11286
|
const resolved = resolveVideoPreset(input.videoPreset);
|
|
11249
11287
|
const wireTier = resolveWireVideoTier(input.videoTier, input.durationSeconds);
|
|
@@ -11268,7 +11306,7 @@ function registerCreativeTools(server, api, { transport = "http" } = {}) {
|
|
|
11268
11306
|
throw translateError(e);
|
|
11269
11307
|
}
|
|
11270
11308
|
});
|
|
11271
|
-
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) => {
|
|
11309
|
+
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) => {
|
|
11272
11310
|
try {
|
|
11273
11311
|
const { projectId, ...rest } = input;
|
|
11274
11312
|
return await submitCreative(api, {
|
|
@@ -11297,7 +11335,7 @@ function registerCreativeTools(server, api, { transport = "http" } = {}) {
|
|
|
11297
11335
|
throw translateError(e);
|
|
11298
11336
|
}
|
|
11299
11337
|
});
|
|
11300
|
-
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) => {
|
|
11338
|
+
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) => {
|
|
11301
11339
|
try {
|
|
11302
11340
|
const { projectId, ...rest } = input;
|
|
11303
11341
|
return await submitCreative(api, {
|
|
@@ -11853,12 +11891,6 @@ var GroupedMediaSource = z53.object({
|
|
|
11853
11891
|
}).refine((value) => !(value.thumbnailUrl && value.thumbnailPath), {
|
|
11854
11892
|
message: "media source needs at most one of `thumbnailUrl` or `thumbnailPath`"
|
|
11855
11893
|
});
|
|
11856
|
-
var GroupedStagedMediaSource = z53.object({
|
|
11857
|
-
type: z53.literal("staged"),
|
|
11858
|
-
/** Legacy source returned by check_meta_media_upload. */
|
|
11859
|
-
stagingAssetId: z53.string().uuid(),
|
|
11860
|
-
thumbnailAssetId: z53.string().uuid().optional()
|
|
11861
|
-
});
|
|
11862
11894
|
var GroupedUploadedAssetSource = z53.object({
|
|
11863
11895
|
type: z53.literal("asset"),
|
|
11864
11896
|
/** Returned by check_media_upload. ProductMaker resolves ownership server-side. */
|
|
@@ -11873,7 +11905,6 @@ var GroupedCreative = z53.object({
|
|
|
11873
11905
|
source: z53.union([
|
|
11874
11906
|
GroupedTaskSource,
|
|
11875
11907
|
GroupedMediaSource,
|
|
11876
|
-
GroupedStagedMediaSource,
|
|
11877
11908
|
GroupedUploadedAssetSource
|
|
11878
11909
|
]),
|
|
11879
11910
|
title: z53.string().max(120).optional(),
|
|
@@ -12105,7 +12136,7 @@ function registerPublishTools(server, api, opts = {}) {
|
|
|
12105
12136
|
throw translateError(e);
|
|
12106
12137
|
}
|
|
12107
12138
|
});
|
|
12108
|
-
server.tool("publish_creatives_to_meta", "Crea UNA campa\xF1a de Meta Ads PAUSED agrupando hasta " + CAMPAIGN_LIMITS.MAX_CREATIVES + ' creativos.
|
|
12139
|
+
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) => {
|
|
12109
12140
|
try {
|
|
12110
12141
|
const parsed = PublishCreativesToMetaInput.safeParse(rawInput);
|
|
12111
12142
|
if (!parsed.success) throw invalidInputFromZod(parsed.error);
|
|
@@ -12131,23 +12162,6 @@ function registerPublishTools(server, api, opts = {}) {
|
|
|
12131
12162
|
});
|
|
12132
12163
|
continue;
|
|
12133
12164
|
}
|
|
12134
|
-
if (creative.source.type === "staged") {
|
|
12135
|
-
creatives.push({
|
|
12136
|
-
type: creative.type,
|
|
12137
|
-
source: {
|
|
12138
|
-
type: "media",
|
|
12139
|
-
mediaAssetId: creative.source.stagingAssetId,
|
|
12140
|
-
...creative.source.thumbnailAssetId ? {
|
|
12141
|
-
thumbnailAssetId: creative.source.thumbnailAssetId
|
|
12142
|
-
} : {}
|
|
12143
|
-
},
|
|
12144
|
-
title: creative.title,
|
|
12145
|
-
description: creative.description,
|
|
12146
|
-
cta: creative.cta,
|
|
12147
|
-
creativeId
|
|
12148
|
-
});
|
|
12149
|
-
continue;
|
|
12150
|
-
}
|
|
12151
12165
|
if (creative.source.type === "asset") {
|
|
12152
12166
|
creatives.push({
|
|
12153
12167
|
type: creative.type,
|
|
@@ -12300,12 +12314,12 @@ __name(toTikTokCampaignConfig, "toTikTokCampaignConfig");
|
|
|
12300
12314
|
// src/tools/meta-upload.ts
|
|
12301
12315
|
import { registerAppTool } from "@modelcontextprotocol/ext-apps/server";
|
|
12302
12316
|
import { z as z54 } from "zod";
|
|
12303
|
-
var
|
|
12317
|
+
var UploadSessionInputBase = z54.object({
|
|
12304
12318
|
mediaKind: z54.enum([
|
|
12305
12319
|
"image",
|
|
12306
12320
|
"video",
|
|
12307
12321
|
"mixed"
|
|
12308
|
-
]).default("mixed").describe("The kind of file the user will select
|
|
12322
|
+
]).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."),
|
|
12309
12323
|
assetRole: z54.enum([
|
|
12310
12324
|
"media",
|
|
12311
12325
|
"thumbnail"
|
|
@@ -12318,18 +12332,18 @@ var OpenAiFileReference = z54.object({
|
|
|
12318
12332
|
mime_type: z54.string().min(1).optional(),
|
|
12319
12333
|
file_name: z54.string().min(1).optional()
|
|
12320
12334
|
}).strict();
|
|
12321
|
-
var
|
|
12322
|
-
...
|
|
12335
|
+
var UploadSessionToolInputShape = {
|
|
12336
|
+
...UploadSessionInputBase.shape,
|
|
12323
12337
|
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.")
|
|
12324
12338
|
};
|
|
12325
|
-
var
|
|
12339
|
+
var UploadSessionToolInput = z54.object(UploadSessionToolInputShape).superRefine((value, ctx) => {
|
|
12326
12340
|
if (value.assetRole === "thumbnail" && value.mediaKind !== "image") {
|
|
12327
12341
|
ctx.addIssue({
|
|
12328
12342
|
code: z54.ZodIssueCode.custom,
|
|
12329
12343
|
path: [
|
|
12330
12344
|
"mediaKind"
|
|
12331
12345
|
],
|
|
12332
|
-
message: "
|
|
12346
|
+
message: "Thumbnails must be images"
|
|
12333
12347
|
});
|
|
12334
12348
|
}
|
|
12335
12349
|
if (value.mediaKind === "video" && value.maxFiles !== void 0 && value.maxFiles !== 1) {
|
|
@@ -12351,7 +12365,7 @@ var MetaUploadSessionToolInput = z54.object(MetaUploadSessionToolInputShape).sup
|
|
|
12351
12365
|
});
|
|
12352
12366
|
}
|
|
12353
12367
|
});
|
|
12354
|
-
var
|
|
12368
|
+
var UploadSessionResponse = z54.object({
|
|
12355
12369
|
sessionId: z54.string().uuid(),
|
|
12356
12370
|
uploadPageUrl: z54.string().url(),
|
|
12357
12371
|
mediaKind: z54.enum([
|
|
@@ -12366,23 +12380,8 @@ var MetaUploadSessionResponse2 = z54.object({
|
|
|
12366
12380
|
maxFiles: z54.number().int().positive(),
|
|
12367
12381
|
expiresAt: z54.string().datetime()
|
|
12368
12382
|
});
|
|
12369
|
-
var
|
|
12370
|
-
sessionId: z54.string().uuid().describe("The sessionId returned by
|
|
12371
|
-
});
|
|
12372
|
-
var MetaUploadStatusResponse = z54.object({
|
|
12373
|
-
sessionId: z54.string().uuid(),
|
|
12374
|
-
status: z54.enum([
|
|
12375
|
-
"pending",
|
|
12376
|
-
"uploaded"
|
|
12377
|
-
]),
|
|
12378
|
-
assets: z54.array(z54.object({
|
|
12379
|
-
stagingAssetId: z54.string().uuid(),
|
|
12380
|
-
mediaKind: z54.enum([
|
|
12381
|
-
"image",
|
|
12382
|
-
"video"
|
|
12383
|
-
])
|
|
12384
|
-
})).max(10).default([]),
|
|
12385
|
-
stagingAssetId: z54.string().uuid().optional()
|
|
12383
|
+
var UploadStatusInput = z54.object({
|
|
12384
|
+
sessionId: z54.string().uuid().describe("The sessionId returned by request_media_upload.")
|
|
12386
12385
|
});
|
|
12387
12386
|
var UniversalUploadStatusResponse = z54.discriminatedUnion("status", [
|
|
12388
12387
|
z54.object({
|
|
@@ -12404,7 +12403,7 @@ var UniversalUploadStatusResponse = z54.discriminatedUnion("status", [
|
|
|
12404
12403
|
})).min(1).max(10)
|
|
12405
12404
|
})
|
|
12406
12405
|
]);
|
|
12407
|
-
var UniversalUploadStructuredResponse =
|
|
12406
|
+
var UniversalUploadStructuredResponse = UploadSessionResponse.extend({
|
|
12408
12407
|
checkToolName: z54.literal("check_media_upload"),
|
|
12409
12408
|
resolveEndpoint: z54.literal("/api/upload-media/resolve")
|
|
12410
12409
|
});
|
|
@@ -12425,11 +12424,11 @@ function uploadSessionText(result) {
|
|
|
12425
12424
|
};
|
|
12426
12425
|
}
|
|
12427
12426
|
__name(uploadSessionText, "uploadSessionText");
|
|
12428
|
-
function
|
|
12427
|
+
function registerMediaUploadTools(server, api) {
|
|
12429
12428
|
registerAppTool(server, "request_media_upload", {
|
|
12430
12429
|
title: "Subir archivos",
|
|
12431
|
-
description: "Abre el selector
|
|
12432
|
-
inputSchema:
|
|
12430
|
+
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.",
|
|
12431
|
+
inputSchema: UploadSessionToolInputShape,
|
|
12433
12432
|
outputSchema: UniversalUploadStructuredResponse.shape,
|
|
12434
12433
|
_meta: {
|
|
12435
12434
|
ui: {
|
|
@@ -12449,9 +12448,9 @@ function registerMetaUploadTools(server, api) {
|
|
|
12449
12448
|
}
|
|
12450
12449
|
}, async (rawInput) => {
|
|
12451
12450
|
try {
|
|
12452
|
-
const input =
|
|
12451
|
+
const input = UploadSessionToolInput.parse(rawInput);
|
|
12453
12452
|
const { files: _files, ...sessionInput } = input;
|
|
12454
|
-
const session =
|
|
12453
|
+
const session = UploadSessionResponse.parse(await api.postJson("/v1/uploaded-assets/sessions", sessionInput));
|
|
12455
12454
|
const result = UniversalUploadStructuredResponse.parse({
|
|
12456
12455
|
...session,
|
|
12457
12456
|
checkToolName: "check_media_upload",
|
|
@@ -12467,69 +12466,20 @@ function registerMetaUploadTools(server, api) {
|
|
|
12467
12466
|
});
|
|
12468
12467
|
server.registerTool("check_media_upload", {
|
|
12469
12468
|
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.",
|
|
12470
|
-
inputSchema:
|
|
12469
|
+
inputSchema: UploadStatusInput.shape,
|
|
12471
12470
|
_meta: {
|
|
12472
12471
|
"openai/widgetAccessible": true
|
|
12473
12472
|
}
|
|
12474
12473
|
}, async (rawInput) => {
|
|
12475
12474
|
try {
|
|
12476
|
-
const input =
|
|
12475
|
+
const input = UploadStatusInput.parse(rawInput);
|
|
12477
12476
|
return asText(UniversalUploadStatusResponse.parse(await api.getJson(`/v1/uploaded-assets/sessions/${encodeURIComponent(input.sessionId)}`)));
|
|
12478
12477
|
} catch (error) {
|
|
12479
12478
|
throw translateError(error);
|
|
12480
12479
|
}
|
|
12481
12480
|
});
|
|
12482
|
-
registerAppTool(server, "request_meta_media_upload", {
|
|
12483
|
-
title: "Solicitar carga segura de Meta",
|
|
12484
|
-
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.",
|
|
12485
|
-
inputSchema: MetaUploadSessionToolInputShape,
|
|
12486
|
-
outputSchema: MetaUploadSessionResponse2.shape,
|
|
12487
|
-
_meta: {
|
|
12488
|
-
ui: {
|
|
12489
|
-
resourceUri: META_UPLOAD_APP_RESOURCE_URI,
|
|
12490
|
-
visibility: [
|
|
12491
|
-
"model",
|
|
12492
|
-
"app"
|
|
12493
|
-
]
|
|
12494
|
-
},
|
|
12495
|
-
"openai/outputTemplate": META_UPLOAD_APP_RESOURCE_URI,
|
|
12496
|
-
"openai/widgetAccessible": true,
|
|
12497
|
-
"openai/fileParams": [
|
|
12498
|
-
"files"
|
|
12499
|
-
],
|
|
12500
|
-
"openai/toolInvocation/invoking": "Preparando carga segura\u2026",
|
|
12501
|
-
"openai/toolInvocation/invoked": "Carga segura lista"
|
|
12502
|
-
}
|
|
12503
|
-
}, async (rawInput) => {
|
|
12504
|
-
try {
|
|
12505
|
-
const input = MetaUploadSessionToolInput.parse(rawInput);
|
|
12506
|
-
const { files: _files, ...sessionInput } = input;
|
|
12507
|
-
const result = MetaUploadSessionResponse2.parse(await api.postJson("/v1/ads/meta-upload-sessions", sessionInput));
|
|
12508
|
-
return {
|
|
12509
|
-
structuredContent: result,
|
|
12510
|
-
...uploadSessionText(result)
|
|
12511
|
-
};
|
|
12512
|
-
} catch (error) {
|
|
12513
|
-
throw translateError(error);
|
|
12514
|
-
}
|
|
12515
|
-
});
|
|
12516
|
-
server.registerTool("check_meta_media_upload", {
|
|
12517
|
-
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.',
|
|
12518
|
-
inputSchema: MetaUploadStatusInput.shape,
|
|
12519
|
-
_meta: {
|
|
12520
|
-
"openai/widgetAccessible": true
|
|
12521
|
-
}
|
|
12522
|
-
}, async (rawInput) => {
|
|
12523
|
-
try {
|
|
12524
|
-
const input = MetaUploadStatusInput.parse(rawInput);
|
|
12525
|
-
const result = MetaUploadStatusResponse.parse(await api.getJson(`/v1/ads/meta-upload-sessions/${encodeURIComponent(input.sessionId)}`));
|
|
12526
|
-
return asText(result);
|
|
12527
|
-
} catch (error) {
|
|
12528
|
-
throw translateError(error);
|
|
12529
|
-
}
|
|
12530
|
-
});
|
|
12531
12481
|
}
|
|
12532
|
-
__name(
|
|
12482
|
+
__name(registerMediaUploadTools, "registerMediaUploadTools");
|
|
12533
12483
|
|
|
12534
12484
|
// src/tools/campaigns.ts
|
|
12535
12485
|
import { z as z55 } from "zod";
|
|
@@ -13572,13 +13522,13 @@ function registerDropshippingProjectTools(server, api) {
|
|
|
13572
13522
|
throw translateError(error);
|
|
13573
13523
|
}
|
|
13574
13524
|
});
|
|
13575
|
-
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 `
|
|
13525
|
+
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) => {
|
|
13576
13526
|
try {
|
|
13577
13527
|
if (!input.projectId) {
|
|
13578
13528
|
return asText({
|
|
13579
13529
|
mode: "choose",
|
|
13580
13530
|
guided: "Usa start_dropshipping_project cuando el usuario quiera encontrar un producto y dejarlo listo para publicar.",
|
|
13581
|
-
direct: "En modo directo usa la herramienta puntual. Para subir/publicar un creativo propio en Meta:
|
|
13531
|
+
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.",
|
|
13582
13532
|
confirmation: "Antes de acciones pagadas o externas, muestra el estimado y pide confirmaci\xF3n.",
|
|
13583
13533
|
safety: "Las campa\xF1as Meta quedan PAUSED; el usuario las activa manualmente en Ads Manager."
|
|
13584
13534
|
});
|
|
@@ -13595,6 +13545,9 @@ __name(registerDropshippingProjectTools, "registerDropshippingProjectTools");
|
|
|
13595
13545
|
var START_DROPSHIPPING_PROMPT_NAME = "start_dropshipping";
|
|
13596
13546
|
var PRODUCTMAKER_SERVER_INSTRUCTIONS = [
|
|
13597
13547
|
"Understand the user's intent before choosing a ProductMaker tool.",
|
|
13548
|
+
"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.",
|
|
13549
|
+
"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.",
|
|
13550
|
+
"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.",
|
|
13598
13551
|
"Keep focused requests direct: creatives, landing pages, Shopify publication, Meta publication, and status checks do not require a DropshippingProject.",
|
|
13599
13552
|
"Use the guided journey only for an explicit end-to-end launch.",
|
|
13600
13553
|
"In guided mode, create a project only after a product is chosen, then call guide_dropshipping_launch after every mutation and follow its nextAction.",
|
|
@@ -13659,7 +13612,7 @@ function createServer(opts) {
|
|
|
13659
13612
|
});
|
|
13660
13613
|
const api = new ApiClient(apiBaseUrl, apiKey);
|
|
13661
13614
|
registerProductMakerPrompts(server);
|
|
13662
|
-
|
|
13615
|
+
registerMediaUploadAppResource(server);
|
|
13663
13616
|
registerProductCostingTools(server);
|
|
13664
13617
|
registerProductResearchTools(server, api);
|
|
13665
13618
|
registerDropshippingProjectTools(server, api);
|
|
@@ -13677,7 +13630,7 @@ function createServer(opts) {
|
|
|
13677
13630
|
registerPublishTools(server, api, {
|
|
13678
13631
|
transport
|
|
13679
13632
|
});
|
|
13680
|
-
|
|
13633
|
+
registerMediaUploadTools(server, api);
|
|
13681
13634
|
registerCampaignTools(server, api);
|
|
13682
13635
|
return server;
|
|
13683
13636
|
}
|