@marlinjai/studio-mcp 0.14.0 → 0.16.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 +1 -0
- package/dist/cli.js +295 -125
- package/dist/index.d.ts +73 -2
- package/dist/index.js +295 -125
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -142,6 +142,25 @@ var StudioClient = class {
|
|
|
142
142
|
deleteCampaign(campaignId) {
|
|
143
143
|
return this.json("DELETE", `/api/campaigns/${encodeURIComponent(campaignId)}`);
|
|
144
144
|
}
|
|
145
|
+
// ── Saved prompts ("My prompts", company-wide) ──
|
|
146
|
+
listSavedPrompts(opts = {}) {
|
|
147
|
+
const q = new URLSearchParams();
|
|
148
|
+
if (opts.sort) q.set("sort", opts.sort);
|
|
149
|
+
if (opts.limit !== void 0) q.set("limit", String(opts.limit));
|
|
150
|
+
if (opts.offset !== void 0) q.set("offset", String(opts.offset));
|
|
151
|
+
const qs = q.toString();
|
|
152
|
+
return this.json("GET", `/api/v1/prompts${qs ? `?${qs}` : ""}`);
|
|
153
|
+
}
|
|
154
|
+
getSavedPrompt(promptId) {
|
|
155
|
+
return this.json("GET", `/api/v1/prompts/${encodeURIComponent(promptId)}`);
|
|
156
|
+
}
|
|
157
|
+
/** 201 saved; 200 with `alreadySaved: true` when the company already saved the same recipe. */
|
|
158
|
+
savePrompt(body) {
|
|
159
|
+
return this.json("POST", "/api/v1/prompts", { json: body });
|
|
160
|
+
}
|
|
161
|
+
deleteSavedPrompt(promptId) {
|
|
162
|
+
return this.json("DELETE", `/api/v1/prompts/${encodeURIComponent(promptId)}`);
|
|
163
|
+
}
|
|
145
164
|
// ── Generation jobs ──
|
|
146
165
|
/**
|
|
147
166
|
* One image job. `brandSlug` is optional: without it the image is generated
|
|
@@ -525,7 +544,7 @@ function resolveConfig(env = process.env) {
|
|
|
525
544
|
}
|
|
526
545
|
|
|
527
546
|
// src/tools.ts
|
|
528
|
-
import { z as
|
|
547
|
+
import { z as z12 } from "zod";
|
|
529
548
|
|
|
530
549
|
// ../lumitra-core/dist/models/index.js
|
|
531
550
|
var veo = (tier, label) => {
|
|
@@ -1486,7 +1505,23 @@ var CATALOG_ENTRIES = [
|
|
|
1486
1505
|
modality: "audio",
|
|
1487
1506
|
task: "text-to-speech",
|
|
1488
1507
|
label: "ElevenLabs Multilingual v2 (TTS)",
|
|
1489
|
-
description: "ElevenLabs Multilingual v2 text-to-speech. 99+ languages, brand-voice cloning capable. Default text-to-speech. Returns mp3 bytes synchronously.",
|
|
1508
|
+
description: "ElevenLabs Multilingual v2 text-to-speech. 99+ languages, brand-voice cloning capable. Default text-to-speech. Returns mp3 bytes synchronously. Up to 10,000 characters per request.",
|
|
1509
|
+
// ElevenLabs' text-to-speech API (voice_settings, checked 2026-10-25):
|
|
1510
|
+
// stability and similarity_boost run from 0 to 1 with defaults 0.5 and
|
|
1511
|
+
// 0.75; speed from 0.7 to 1.2 with 1 as the normal pace (its help center
|
|
1512
|
+
// states the bounds). Multilingual v2 takes 10,000 characters per request
|
|
1513
|
+
// (its models page). `speechRequestRefusal` refuses anything outside these
|
|
1514
|
+
// before a request is admitted.
|
|
1515
|
+
capabilities: {
|
|
1516
|
+
speech: {
|
|
1517
|
+
maxCharacters: 1e4,
|
|
1518
|
+
voiceSettings: {
|
|
1519
|
+
stability: { min: 0, max: 1, step: 0.05, default: 0.5 },
|
|
1520
|
+
similarityBoost: { min: 0, max: 1, step: 0.05, default: 0.75 },
|
|
1521
|
+
speed: { min: 0.7, max: 1.2, step: 0.05, default: 1 }
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
},
|
|
1490
1525
|
isDefault: true
|
|
1491
1526
|
},
|
|
1492
1527
|
{
|
|
@@ -1550,14 +1585,20 @@ var CATALOG_ENTRIES = [
|
|
|
1550
1585
|
modality: "image",
|
|
1551
1586
|
task: "text-to-image",
|
|
1552
1587
|
label: "Gemini 2.5 Flash Image",
|
|
1553
|
-
description: "Vertex AI direct. Fallback if KIE pricing or reliability turns sour. Needs GAC_JSON provisioning to activate. Google retires this model on 2027-03-15 (deprecations table, checked 2026-10-07); its named successor is gemini-3.1-flash-lite-image."
|
|
1588
|
+
description: "Vertex AI direct. Fallback if KIE pricing or reliability turns sour. Needs GAC_JSON provisioning to activate. Google retires this model on 2027-03-15 (deprecations table, checked 2026-10-07); its named successor is gemini-3.1-flash-lite-image.",
|
|
1589
|
+
// Google's model page (read 2026-10-25): "Maximum images per prompt: 3".
|
|
1590
|
+
// The adapter sends every image inline, downloading Studio references
|
|
1591
|
+
// first (providers/vertex.ts), up to 7 MB each.
|
|
1592
|
+
capabilities: { maxInputImages: 3 }
|
|
1554
1593
|
},
|
|
1555
1594
|
{
|
|
1556
1595
|
id: "vertex/gemini-3-pro-image-preview",
|
|
1557
1596
|
provider: "vertex",
|
|
1558
1597
|
modality: "image",
|
|
1559
1598
|
task: "text-to-image",
|
|
1560
|
-
label: "Nano Banana Pro (preview)"
|
|
1599
|
+
label: "Nano Banana Pro (preview)",
|
|
1600
|
+
// Google's model page for Gemini 3 Pro Image (read 2026-10-25): "Maximum images per prompt: 14".
|
|
1601
|
+
capabilities: { maxInputImages: 14 }
|
|
1561
1602
|
},
|
|
1562
1603
|
{
|
|
1563
1604
|
id: "vertex/gemini-3-1-flash-image-preview",
|
|
@@ -1565,7 +1606,9 @@ var CATALOG_ENTRIES = [
|
|
|
1565
1606
|
modality: "image",
|
|
1566
1607
|
task: "text-to-image",
|
|
1567
1608
|
label: "Gemini 3.1 Flash Image (preview)",
|
|
1568
|
-
description: "Vertex AI direct, newest flash variant. Global region. Preview status."
|
|
1609
|
+
description: "Vertex AI direct, newest flash variant. Global region. Preview status.",
|
|
1610
|
+
// Google's model page for Gemini 3.1 Flash Image (read 2026-10-25): "Maximum images per prompt: 14".
|
|
1611
|
+
capabilities: { maxInputImages: 14 }
|
|
1569
1612
|
}
|
|
1570
1613
|
];
|
|
1571
1614
|
var PINNED_FAL_NOTE = "Pinned to fal: a job on this entry never goes to KIE.";
|
|
@@ -2044,6 +2087,12 @@ var VIDEO_MAX_SECONDS_AT_RESOLUTION = {
|
|
|
2044
2087
|
[LTX_25_FAST_I2V_ENDPOINT]: { "4k": 10 }
|
|
2045
2088
|
};
|
|
2046
2089
|
var VIDEO_UNSUPPORTED_PARAMS = {
|
|
2090
|
+
// Kling 2.5 Turbo and Seedance 1.0 Pro render silent clips and their schemas
|
|
2091
|
+
// declare no audio field at all (fal model schemas, checked 2026-10-25), so a
|
|
2092
|
+
// sound choice is refused before submit instead of being sent and ignored.
|
|
2093
|
+
"fal-ai/kling-video/v2.5-turbo/pro/image-to-video": ["generateAudio"],
|
|
2094
|
+
"fal-ai/bytedance/seedance/v1/pro/image-to-video": ["generateAudio"],
|
|
2095
|
+
"fal-ai/bytedance/seedance/v1/pro/text-to-video": ["generateAudio"],
|
|
2047
2096
|
// Kling O3 Edit follows the source clip: its length, frame, size and look are
|
|
2048
2097
|
// the source's, and the endpoint declares none of these knobs. A duration in
|
|
2049
2098
|
// particular would only have been a (wrong) billing figure; the completer
|
|
@@ -2090,6 +2139,22 @@ var VIDEO_UNSUPPORTED_PARAMS = {
|
|
|
2090
2139
|
[KLING_O3_PRO_R2V_ENDPOINT]: ["resolution", "seed", "negativePrompt"],
|
|
2091
2140
|
...Object.fromEntries(LTX_25_I2V_ENDPOINTS.map((e) => [e, ["seed", "negativePrompt"]]))
|
|
2092
2141
|
};
|
|
2142
|
+
var VIDEO_AUDIO_SWITCH = {
|
|
2143
|
+
...Object.fromEntries(VEO_ENDPOINTS.map((e) => [e, { default: false }])),
|
|
2144
|
+
[KLING_26_I2V_ENDPOINT]: { default: false },
|
|
2145
|
+
...Object.fromEntries(KLING_O3_I2V_ENDPOINTS.map((e) => [e, { default: false }])),
|
|
2146
|
+
[KLING_O3_PRO_R2V_ENDPOINT]: { default: false },
|
|
2147
|
+
"bytedance/seedance-2.5/image-to-video": { default: true },
|
|
2148
|
+
"bytedance/seedance-2.0/image-to-video": { default: true },
|
|
2149
|
+
[WAN_30_I2V_ENDPOINT]: { default: true },
|
|
2150
|
+
...Object.fromEntries(LTX_25_I2V_ENDPOINTS.map((e) => [e, { default: true }])),
|
|
2151
|
+
"blackforestlabs/flux-3/image-to-video/draft": { default: true },
|
|
2152
|
+
"blackforestlabs/flux-3/first-last-frame-to-video/draft": { default: true },
|
|
2153
|
+
"blackforestlabs/flux-3/keyframes-to-video/draft": { default: true },
|
|
2154
|
+
"blackforestlabs/flux-3/image-to-video": { default: true },
|
|
2155
|
+
"blackforestlabs/flux-3/first-last-frame-to-video": { default: true },
|
|
2156
|
+
"blackforestlabs/flux-3/keyframes-to-video": { default: true }
|
|
2157
|
+
};
|
|
2093
2158
|
var ROWS = [
|
|
2094
2159
|
[0, "Idle", "DailyActions", "Idle"],
|
|
2095
2160
|
[1, "Walking_Woman", "WalkAndRun", "Walking"],
|
|
@@ -4145,7 +4210,23 @@ var CATALOG_ENTRIES2 = [
|
|
|
4145
4210
|
modality: "audio",
|
|
4146
4211
|
task: "text-to-speech",
|
|
4147
4212
|
label: "ElevenLabs Multilingual v2 (TTS)",
|
|
4148
|
-
description: "ElevenLabs Multilingual v2 text-to-speech. 99+ languages, brand-voice cloning capable. Default text-to-speech. Returns mp3 bytes synchronously.",
|
|
4213
|
+
description: "ElevenLabs Multilingual v2 text-to-speech. 99+ languages, brand-voice cloning capable. Default text-to-speech. Returns mp3 bytes synchronously. Up to 10,000 characters per request.",
|
|
4214
|
+
// ElevenLabs' text-to-speech API (voice_settings, checked 2026-10-25):
|
|
4215
|
+
// stability and similarity_boost run from 0 to 1 with defaults 0.5 and
|
|
4216
|
+
// 0.75; speed from 0.7 to 1.2 with 1 as the normal pace (its help center
|
|
4217
|
+
// states the bounds). Multilingual v2 takes 10,000 characters per request
|
|
4218
|
+
// (its models page). `speechRequestRefusal` refuses anything outside these
|
|
4219
|
+
// before a request is admitted.
|
|
4220
|
+
capabilities: {
|
|
4221
|
+
speech: {
|
|
4222
|
+
maxCharacters: 1e4,
|
|
4223
|
+
voiceSettings: {
|
|
4224
|
+
stability: { min: 0, max: 1, step: 0.05, default: 0.5 },
|
|
4225
|
+
similarityBoost: { min: 0, max: 1, step: 0.05, default: 0.75 },
|
|
4226
|
+
speed: { min: 0.7, max: 1.2, step: 0.05, default: 1 }
|
|
4227
|
+
}
|
|
4228
|
+
}
|
|
4229
|
+
},
|
|
4149
4230
|
isDefault: true
|
|
4150
4231
|
},
|
|
4151
4232
|
{
|
|
@@ -4209,14 +4290,20 @@ var CATALOG_ENTRIES2 = [
|
|
|
4209
4290
|
modality: "image",
|
|
4210
4291
|
task: "text-to-image",
|
|
4211
4292
|
label: "Gemini 2.5 Flash Image",
|
|
4212
|
-
description: "Vertex AI direct. Fallback if KIE pricing or reliability turns sour. Needs GAC_JSON provisioning to activate. Google retires this model on 2027-03-15 (deprecations table, checked 2026-10-07); its named successor is gemini-3.1-flash-lite-image."
|
|
4293
|
+
description: "Vertex AI direct. Fallback if KIE pricing or reliability turns sour. Needs GAC_JSON provisioning to activate. Google retires this model on 2027-03-15 (deprecations table, checked 2026-10-07); its named successor is gemini-3.1-flash-lite-image.",
|
|
4294
|
+
// Google's model page (read 2026-10-25): "Maximum images per prompt: 3".
|
|
4295
|
+
// The adapter sends every image inline, downloading Studio references
|
|
4296
|
+
// first (providers/vertex.ts), up to 7 MB each.
|
|
4297
|
+
capabilities: { maxInputImages: 3 }
|
|
4213
4298
|
},
|
|
4214
4299
|
{
|
|
4215
4300
|
id: "vertex/gemini-3-pro-image-preview",
|
|
4216
4301
|
provider: "vertex",
|
|
4217
4302
|
modality: "image",
|
|
4218
4303
|
task: "text-to-image",
|
|
4219
|
-
label: "Nano Banana Pro (preview)"
|
|
4304
|
+
label: "Nano Banana Pro (preview)",
|
|
4305
|
+
// Google's model page for Gemini 3 Pro Image (read 2026-10-25): "Maximum images per prompt: 14".
|
|
4306
|
+
capabilities: { maxInputImages: 14 }
|
|
4220
4307
|
},
|
|
4221
4308
|
{
|
|
4222
4309
|
id: "vertex/gemini-3-1-flash-image-preview",
|
|
@@ -4224,7 +4311,9 @@ var CATALOG_ENTRIES2 = [
|
|
|
4224
4311
|
modality: "image",
|
|
4225
4312
|
task: "text-to-image",
|
|
4226
4313
|
label: "Gemini 3.1 Flash Image (preview)",
|
|
4227
|
-
description: "Vertex AI direct, newest flash variant. Global region. Preview status."
|
|
4314
|
+
description: "Vertex AI direct, newest flash variant. Global region. Preview status.",
|
|
4315
|
+
// Google's model page for Gemini 3.1 Flash Image (read 2026-10-25): "Maximum images per prompt: 14".
|
|
4316
|
+
capabilities: { maxInputImages: 14 }
|
|
4228
4317
|
}
|
|
4229
4318
|
];
|
|
4230
4319
|
var PINNED_FAL_NOTE2 = "Pinned to fal: a job on this entry never goes to KIE.";
|
|
@@ -5865,7 +5954,7 @@ var studioWorkflowDescribe = defineTool({
|
|
|
5865
5954
|
inputSchema: {
|
|
5866
5955
|
tasks: z7.array(z7.string().min(1)).min(1).optional().describe('Only these task ids (e.g. ["text-to-image", "image-to-video"]). An unknown id is an error that lists the known ones.'),
|
|
5867
5956
|
includeSettings: z7.boolean().default(false).describe("Include each task's settings knobs (key, type, range, default)."),
|
|
5868
|
-
includeModels: z7.boolean().default(false).describe("Include the model catalog per task (id, label, provider, price, isDefault). price is what one generation costs your company at the default settings: { usd, fromUsd? }.")
|
|
5957
|
+
includeModels: z7.boolean().default(false).describe("Include the model catalog per task (id, label, provider, price, isDefault). price is what one generation costs your company at the default settings: { usd, fromUsd? }. A voice model is billed per character: its price is { usd, per: { characters: 1000 }, maxUsd }, usd for 1,000 characters and maxUsd the most one generation costs.")
|
|
5869
5958
|
},
|
|
5870
5959
|
annotations: { readOnlyHint: true },
|
|
5871
5960
|
handler: async (args, ctx) => {
|
|
@@ -6599,6 +6688,9 @@ var COMPOSITION_TOOLS = [
|
|
|
6599
6688
|
studioCompositionSendToSocial
|
|
6600
6689
|
];
|
|
6601
6690
|
|
|
6691
|
+
// src/promptTools.ts
|
|
6692
|
+
import { z as z11 } from "zod";
|
|
6693
|
+
|
|
6602
6694
|
// src/manageTools.ts
|
|
6603
6695
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
6604
6696
|
import { z as z10 } from "zod";
|
|
@@ -6847,10 +6939,87 @@ var MANAGE_TOOLS = [
|
|
|
6847
6939
|
studioDeleteCampaign
|
|
6848
6940
|
];
|
|
6849
6941
|
|
|
6942
|
+
// src/promptTools.ts
|
|
6943
|
+
var MAX_MENTIONS = 10;
|
|
6944
|
+
var mentionSchema = z11.object({
|
|
6945
|
+
kind: z11.enum(["character", "product", "location"]),
|
|
6946
|
+
id: z11.string().max(200).regex(/^[a-z0-9-]+$/, "lowercase letters, numbers and hyphens only").describe("The cast member's slug, as in the prompt token @[kind:slug]."),
|
|
6947
|
+
name: z11.string().min(1).max(200).describe("Its display name."),
|
|
6948
|
+
rowId: z11.string().min(1).max(200).optional().describe("Its database id, when known.")
|
|
6949
|
+
}).strict();
|
|
6950
|
+
var settingsSchema = z11.object({
|
|
6951
|
+
model: z11.string().min(1).max(200).optional(),
|
|
6952
|
+
aspectRatio: z11.string().min(1).max(32).optional(),
|
|
6953
|
+
imageSize: z11.string().min(1).max(32).optional(),
|
|
6954
|
+
candidateCount: z11.number().int().min(1).max(8).optional(),
|
|
6955
|
+
thinkingLevel: z11.enum(["none", "minimal", "high"]).optional(),
|
|
6956
|
+
temperature: z11.number().min(0).max(2).optional(),
|
|
6957
|
+
seed: z11.number().int().optional()
|
|
6958
|
+
}).strict();
|
|
6959
|
+
function promptDeleteSummary(p) {
|
|
6960
|
+
const text = p.prompt.trim();
|
|
6961
|
+
const shown = text.length > 120 ? `${text.slice(0, 117)}...` : text;
|
|
6962
|
+
const used = p.usageCount > 0 ? ` It was used ${p.usageCount === 1 ? "once" : `${p.usageCount} times`}.` : "";
|
|
6963
|
+
return `Delete the saved prompt "${p.title}" ("${shown}") from the company's prompt library, for everyone in the company?${used} Images made with it stay. This cannot be undone.`;
|
|
6964
|
+
}
|
|
6965
|
+
function promptSubject(p) {
|
|
6966
|
+
return ["delete-prompt", p.id, p.title, p.updatedAt].join(":");
|
|
6967
|
+
}
|
|
6968
|
+
var studioPromptsList = defineTool({
|
|
6969
|
+
name: "studio_prompts_list",
|
|
6970
|
+
description: 'List the company\'s saved prompts ("My prompts"): prompts that worked, kept to use again, shared by every project and every person in the company. Each has `prompt` (with mention tokens such as @[character:bruno]), `mentions`, `settings` (model, aspectRatio, imageSize, candidateCount, ...), `title`, `usageCount` and `savedByMe`. Newest first, or `sort: "most-used"`. Pages with `limit` (up to 200) and the returned `nextOffset`. Free.',
|
|
6971
|
+
inputSchema: {
|
|
6972
|
+
sort: z11.enum(["newest", "most-used"]).optional().describe("newest (default) or most-used."),
|
|
6973
|
+
limit: z11.number().int().min(1).max(200).optional().describe("How many to return, 1 to 200 (default 50)."),
|
|
6974
|
+
offset: z11.number().int().min(0).optional().describe("Where to start: the nextOffset of the previous page.")
|
|
6975
|
+
},
|
|
6976
|
+
annotations: { readOnlyHint: true },
|
|
6977
|
+
handler: async (args, ctx) => ctx.client.listSavedPrompts(args)
|
|
6978
|
+
});
|
|
6979
|
+
var studioPromptsSave = defineTool({
|
|
6980
|
+
name: "studio_prompts_save",
|
|
6981
|
+
description: "Save a prompt to the company's prompt library, to use again. Either the prompt itself (`prompt`, optional `mentions` and `settings`), or `assetId`: the recipe that image was made with (its prompt, mentions and settings), with any field you also send replacing the copied one. `title` defaults to the first words of the prompt. Saving the same prompt, mentions and settings again returns the prompt saved first with `alreadySaved: true`, never a second copy. A prompt whose mention tokens are not all listed in `mentions` is refused (400 invalid_mentions), exactly as studio_generate_image would refuse it. An image of another company, a video and an image without a recorded prompt are refused. Free.",
|
|
6982
|
+
inputSchema: {
|
|
6983
|
+
prompt: z11.string().min(1).max(2e4).optional().describe("The prompt text, mention tokens such as @[character:bruno] included."),
|
|
6984
|
+
mentions: z11.array(mentionSchema).max(MAX_MENTIONS).optional().describe(`The cast mentioned in the prompt, in prompt order (at most ${MAX_MENTIONS}). Every @[kind:slug] token of the prompt must be listed, as for studio_generate_image.`),
|
|
6985
|
+
settings: settingsSchema.optional().describe("The generation settings to keep with it."),
|
|
6986
|
+
title: z11.string().min(1).max(120).optional().describe("A name for the prompt; defaults to its first words."),
|
|
6987
|
+
assetId: z11.string().min(1).optional().describe("An image, from studio_list_assets: save the prompt it was made with.")
|
|
6988
|
+
},
|
|
6989
|
+
annotations: { idempotentHint: true },
|
|
6990
|
+
handler: async (args, ctx) => {
|
|
6991
|
+
if (!args.prompt && !args.assetId) throw new ToolInputError("Send the prompt text, or an assetId to save the prompt that image was made with.");
|
|
6992
|
+
const res = await ctx.client.savePrompt(args);
|
|
6993
|
+
return { prompt: res.prompt, alreadySaved: res.alreadySaved === true };
|
|
6994
|
+
}
|
|
6995
|
+
});
|
|
6996
|
+
var studioPromptsDelete = defineTool({
|
|
6997
|
+
name: "studio_prompts_delete",
|
|
6998
|
+
description: "Delete a saved prompt from the company's prompt library, for everyone in the company. Images made with it stay. The PERSON confirms every delete in the chat: this tool shows them the prompt through the client's confirmation dialog before anything happens. If the client has no such dialog, the tool returns `confirmationRequired` with a `summary` and a `confirmationToken`: show the summary to the person exactly as written, and only after they explicitly say yes call again with the token. Never confirm on their behalf.",
|
|
6999
|
+
inputSchema: {
|
|
7000
|
+
promptId: z11.string().min(1).describe("The saved prompt, from studio_prompts_list."),
|
|
7001
|
+
confirmationToken
|
|
7002
|
+
},
|
|
7003
|
+
annotations: { destructiveHint: true },
|
|
7004
|
+
handler: async (args, ctx) => {
|
|
7005
|
+
const { prompt } = await ctx.client.getSavedPrompt(args.promptId);
|
|
7006
|
+
const summary = promptDeleteSummary(prompt);
|
|
7007
|
+
const gate = await confirmWithPerson(ctx, summary, promptSubject(prompt), args.confirmationToken);
|
|
7008
|
+
if (gate !== "proceed") return gate;
|
|
7009
|
+
try {
|
|
7010
|
+
const res = await ctx.client.deleteSavedPrompt(args.promptId);
|
|
7011
|
+
return { deleted: true, promptId: res.deleted, summary };
|
|
7012
|
+
} catch (err) {
|
|
7013
|
+
return roleRefusal(err, "Deleting a saved prompt needs a key with at least the company member role; this key does not have it.");
|
|
7014
|
+
}
|
|
7015
|
+
}
|
|
7016
|
+
});
|
|
7017
|
+
var PROMPT_TOOLS = [studioPromptsList, studioPromptsSave, studioPromptsDelete];
|
|
7018
|
+
|
|
6850
7019
|
// src/tools.ts
|
|
6851
|
-
var slug =
|
|
6852
|
-
var waitSeconds =
|
|
6853
|
-
var httpUrl =
|
|
7020
|
+
var slug = z12.string().regex(/^[a-z0-9-]+$/, "lowercase letters, numbers and hyphens only").describe("URL-safe identifier: lowercase letters, numbers, hyphens.");
|
|
7021
|
+
var waitSeconds = z12.number().int().min(1).max(3600).default(DEFAULT_TIMEOUT_MS / 1e3).describe("Maximum seconds to wait before giving up and returning the id to poll later. Default 600.");
|
|
7022
|
+
var httpUrl = z12.string().url().refine((u) => /^https?:\/\//i.test(u), "must be an http(s) URL");
|
|
6854
7023
|
function pollOpts(ctx, timeoutSec) {
|
|
6855
7024
|
return { ...ctx.poll, timeoutMs: timeoutSec * 1e3 };
|
|
6856
7025
|
}
|
|
@@ -6926,30 +7095,30 @@ var studioGenerateImage = defineTool({
|
|
|
6926
7095
|
brandSlug: slug.optional().describe(
|
|
6927
7096
|
"Optional. The slug of a brand of your company (create one with studio_create_brand). Omit it to generate without a brand. A slug that names no brand of your company is refused with 404 input_not_found; it is never used as a project name."
|
|
6928
7097
|
),
|
|
6929
|
-
brandMode:
|
|
6930
|
-
prompt:
|
|
7098
|
+
brandMode: z12.string().optional().describe('Optional brand mode (e.g. "illustration"); modes are defined per brand. Only meaningful with brandSlug.'),
|
|
7099
|
+
prompt: z12.string().min(1).describe("What to generate. With brandSlug, the brand style prefix is prepended server-side."),
|
|
6931
7100
|
characterSlug: slug.optional().describe(
|
|
6932
7101
|
"Optional character whose identity references are injected: one of your company's, or one another company shared (see studio_list_characters). A slug your company cannot use is refused with 404 input_not_found. To put several characters, products or locations in one image, use mentions instead."
|
|
6933
7102
|
),
|
|
6934
|
-
mentions:
|
|
6935
|
-
|
|
6936
|
-
kind:
|
|
7103
|
+
mentions: z12.array(
|
|
7104
|
+
z12.object({
|
|
7105
|
+
kind: z12.enum(["character", "product", "location"]).describe("What the mention names."),
|
|
6937
7106
|
id: slug.describe("The slug of the character (studio_list_characters), product or location (GET /api/products, GET /api/locations).")
|
|
6938
7107
|
})
|
|
6939
7108
|
).min(1).max(10).optional().describe(
|
|
6940
7109
|
"Optional: the characters, products and locations of your company to put in the image, in the order the prompt names them (at most 10). Each one's reference images are sent in that order and the Studio tells the model which image is which, so name them in the prompt by their names (or as tokens such as @[character:ana], which the Studio replaces with the name). The model must take a reference image for each mention plus any attached image: an edit model such as fal/nano-banana-2-edit takes 8, and so does the default when no model is named (with mentions and a candidateCount above 1 the default is fal/nano-banana-2-edit, which renders up to 4); a text-only model takes none. Too many is refused with 400 too_many_references, a model that cannot take references with 400 model_takes_no_references, both before anything is spent. A mention your company cannot use is refused with 404 input_not_found, one without a reference image with 422 mention_without_reference. Sent together with characterSlug, that character comes first."
|
|
6941
7110
|
),
|
|
6942
|
-
projectId:
|
|
7111
|
+
projectId: z12.string().min(1).optional().describe(
|
|
6943
7112
|
'Optional project to file the image under (an id from studio_list_projects; it must be a project of your company, anything else is a 404). Omit it to use the project named after brandSlug, or "default" when there is no brand.'
|
|
6944
7113
|
),
|
|
6945
|
-
model:
|
|
6946
|
-
aspectRatio:
|
|
6947
|
-
imageSize:
|
|
6948
|
-
seed:
|
|
6949
|
-
candidateCount:
|
|
7114
|
+
model: z12.string().optional().describe('Image model id (e.g. "kie/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default.'),
|
|
7115
|
+
aspectRatio: z12.string().optional().describe('Aspect ratio such as "1:1", "16:9", "3:4".'),
|
|
7116
|
+
imageSize: z12.string().optional().describe('Provider size hint, e.g. "1K", "2K".'),
|
|
7117
|
+
seed: z12.number().int().optional(),
|
|
7118
|
+
candidateCount: z12.number().int().min(1).max(4).optional().describe(
|
|
6950
7119
|
"Number of candidates (1 to 4). Not every model takes a count: most KIE image models render one image whatever is asked, and a `route/...` model runs on KIE first, so expect one there too (its fal fallback may render up to four). The result carries `candidates: { requested, rendered, mayRender? }`, plus a `notice` whenever fewer will be rendered than were asked for; only rendered images are charged."
|
|
6951
7120
|
),
|
|
6952
|
-
wait:
|
|
7121
|
+
wait: z12.boolean().default(true).describe("Poll until the job finishes (default true)."),
|
|
6953
7122
|
waitSeconds
|
|
6954
7123
|
},
|
|
6955
7124
|
handler: async (args, ctx) => {
|
|
@@ -6986,23 +7155,23 @@ var studioGenerate3d = defineTool({
|
|
|
6986
7155
|
name: "studio_generate_3d",
|
|
6987
7156
|
description: "Generate one 3D model (a textured GLB mesh) through 3D AI Studio, from a text prompt or from one image (imageUrl). Text models: studio3d/tripo-3-1-text-to-3d (the default), studio3d/hunyuan-3-1-rapid, studio3d/hunyuan-3-1-pro. Image models: studio3d/trellis-2 (the default when imageUrl is given), studio3d/tripo-3-1-image-to-3d. Submits a job and, when wait=true (default), polls until it finishes (usually one to five minutes) and returns the signed GLB URL and its cost in USD (Studio prices the request it sent, since 3D AI Studio reports no per-job charge). With wait=false it returns the jobId for studio_get_job. The price follows the model and the quality flags; the returned costUsd is the exact amount.",
|
|
6988
7157
|
inputSchema: {
|
|
6989
|
-
prompt:
|
|
7158
|
+
prompt: z12.string().min(1).max(1024).describe("What to model. With imageUrl, a short description of the object in the image."),
|
|
6990
7159
|
imageUrl: httpUrl.optional().describe("Public http(s) URL of one image to model from. Selects an image model."),
|
|
6991
|
-
model:
|
|
6992
|
-
options:
|
|
6993
|
-
enableTexture:
|
|
6994
|
-
enablePbr:
|
|
6995
|
-
textureQuality:
|
|
6996
|
-
geometryQuality:
|
|
6997
|
-
quadRemesh:
|
|
6998
|
-
smartLowPoly:
|
|
6999
|
-
resolution:
|
|
7000
|
-
targetPolycount:
|
|
7001
|
-
topology:
|
|
7002
|
-
seed:
|
|
7160
|
+
model: z12.string().min(1).optional().describe("3D model id from the list in the description. Omit for the default (text or image, by whether imageUrl is given)."),
|
|
7161
|
+
options: z12.object({
|
|
7162
|
+
enableTexture: z12.boolean().optional().describe("Texture the mesh (default true). Off gives bare geometry and costs less."),
|
|
7163
|
+
enablePbr: z12.boolean().optional().describe("Physically-based rendering (PBR) material maps. Default on for Hunyuan Pro, off elsewhere."),
|
|
7164
|
+
textureQuality: z12.enum(["standard", "detailed"]).optional().describe("Tripo texture tier. detailed costs more."),
|
|
7165
|
+
geometryQuality: z12.enum(["standard", "detailed"]).optional().describe("Tripo geometry tier. detailed costs more."),
|
|
7166
|
+
quadRemesh: z12.boolean().optional().describe("Tripo: quad topology instead of triangles."),
|
|
7167
|
+
smartLowPoly: z12.boolean().optional().describe("Tripo text-to-3D: a low-poly mesh."),
|
|
7168
|
+
resolution: z12.enum(["512", "1024", "1536"]).optional().describe("TRELLIS.2 resolution (default 1024)."),
|
|
7169
|
+
targetPolycount: z12.number().int().min(100).max(15e5).optional().describe("Target face count, where the model supports one."),
|
|
7170
|
+
topology: z12.enum(["quad", "triangle"]).optional().describe("Hunyuan Pro polygon type."),
|
|
7171
|
+
seed: z12.number().int().optional()
|
|
7003
7172
|
}).optional().describe("Model-specific quality flags. Each changes the price; the returned costUsd is the price of the request that was sent."),
|
|
7004
|
-
projectId:
|
|
7005
|
-
wait:
|
|
7173
|
+
projectId: z12.string().min(1).optional().describe("Project to file the model under (from studio_list_projects). Omit for the default project."),
|
|
7174
|
+
wait: z12.boolean().default(true).describe("Poll until the job finishes (default true)."),
|
|
7006
7175
|
waitSeconds
|
|
7007
7176
|
},
|
|
7008
7177
|
handler: async (args, ctx) => {
|
|
@@ -7040,8 +7209,8 @@ var studioFindAnimations = defineTool({
|
|
|
7040
7209
|
name: "studio_find_animations",
|
|
7041
7210
|
description: 'Search Meshy\'s animation library (678 presets in five categories: WalkAndRun, BodyMovements, DailyActions, Fighting, Dancing) for the presets studio_rig_3d can apply. Every word of the query must match a preset\'s name, category or subcategory (e.g. "sword", "walking woman", "dance"). Free and local: no request, no cost. Returns id, name and category for up to `limit` matches.',
|
|
7042
7211
|
inputSchema: {
|
|
7043
|
-
query:
|
|
7044
|
-
limit:
|
|
7212
|
+
query: z12.string().describe('Words to match, e.g. "sword slash". Empty returns the first presets in library order.'),
|
|
7213
|
+
limit: z12.number().int().min(1).max(50).default(25)
|
|
7045
7214
|
},
|
|
7046
7215
|
annotations: { readOnlyHint: true },
|
|
7047
7216
|
handler: async (args) => ({ animations: searchAnimations(args.query, args.limit) })
|
|
@@ -7050,12 +7219,12 @@ var studioRig3d = defineTool({
|
|
|
7050
7219
|
name: "studio_rig_3d",
|
|
7051
7220
|
description: "Rig a humanoid 3D model and animate it (Meshy on fal): adds a skeleton and skin weights to a Model3D asset and applies up to 10 animation presets from Meshy's library; walk and run clips always come with the rig. Pass the mesh's assetId (studio_generate_3d returns it as assetId) and presets as names or ids (find them with studio_find_animations). Runs as a one-node workflow, so the cost gate and quota apply. Waits by default (usually one to three minutes) and returns the rigged GLB url, each clip's name and url, and costUsd (what it cost your company: a price per rig plus a price per preset). Humanoid characters only: an animal or an object will fail at the provider.",
|
|
7052
7221
|
inputSchema: {
|
|
7053
|
-
projectId:
|
|
7054
|
-
meshAssetId:
|
|
7055
|
-
animations:
|
|
7056
|
-
heightMeters:
|
|
7057
|
-
visibility:
|
|
7058
|
-
wait:
|
|
7222
|
+
projectId: z12.string().min(1).describe("The project the mesh lives in (from studio_list_projects)."),
|
|
7223
|
+
meshAssetId: z12.string().min(1).describe("The Model3D asset to rig: the assetId studio_generate_3d returned."),
|
|
7224
|
+
animations: z12.array(z12.union([z12.string().min(1), z12.number().int()])).max(RIG_MAX_CLIPS).default([]).describe('Up to 10 presets, each a name ("Double_Combo_Attack", or loosely "double combo attack") or an id. Empty rigs with only the included walk and run.'),
|
|
7225
|
+
heightMeters: z12.number().min(0.3).max(5).optional().describe("The character's approximate height in meters (default 1.7); Meshy scales the rig to it."),
|
|
7226
|
+
visibility: z12.enum(["listed", "unlisted"]).optional(),
|
|
7227
|
+
wait: z12.boolean().default(true).describe("Poll until the rig finishes (default true)."),
|
|
7059
7228
|
waitSeconds
|
|
7060
7229
|
},
|
|
7061
7230
|
handler: async (args, ctx) => {
|
|
@@ -7112,8 +7281,8 @@ var studioGetJob = defineTool({
|
|
|
7112
7281
|
name: "studio_get_job",
|
|
7113
7282
|
description: "Fetch the status of a generation job by jobId: status (queued, running, succeeded, failed, canceled), cost, model, error message and a freshly signed result URL once it succeeded. Set wait=true to block until the job reaches a terminal state.",
|
|
7114
7283
|
inputSchema: {
|
|
7115
|
-
jobId:
|
|
7116
|
-
wait:
|
|
7284
|
+
jobId: z12.string().min(1),
|
|
7285
|
+
wait: z12.boolean().default(false).describe("Poll until terminal (default false: return the current state)."),
|
|
7117
7286
|
waitSeconds
|
|
7118
7287
|
},
|
|
7119
7288
|
annotations: { readOnlyHint: true },
|
|
@@ -7146,18 +7315,18 @@ var studioPromptEnhance = defineTool({
|
|
|
7146
7315
|
name: "studio_prompt_enhance",
|
|
7147
7316
|
description: "Rewrite a short prompt into a richer one an image or video model renders well: subject, setting, light, lens and composition (for video also the camera movement and the action over the shot), in the language of the prompt, without changing what it asks for. Free for your company (nothing is charged, no job is created), but limited per API key over a few minutes and per company per day: past either it answers an error that says when to try again, so wait that long rather than retrying. A person, product or place of your company goes into the prompt as a mention token, `@[character:<slug>]`, `@[product:<slug>]` or `@[location:<slug>]` (slugs from studio_list_characters, GET /api/products, GET /api/locations), and every token must also be listed in `mentions`; the rewrite keeps each token exactly once, so pass the returned prompt and mentions on unchanged. A mention or brandSlug your company cannot use is refused with 404 input_not_found. With brandSlug the rewrite follows the brand's style guide without copying it (studio_generate_image applies it again). Nothing is generated: pass the returned prompt and mentions unchanged to studio_generate_image as its prompt and mentions.",
|
|
7148
7317
|
inputSchema: {
|
|
7149
|
-
prompt:
|
|
7150
|
-
target:
|
|
7151
|
-
mentions:
|
|
7152
|
-
|
|
7153
|
-
kind:
|
|
7318
|
+
prompt: z12.string().min(1).max(4e3).describe("The prompt to rewrite, mention tokens included."),
|
|
7319
|
+
target: z12.enum(["image", "video"]).default("image").describe('What the prompt is for: "image" (default) or "video".'),
|
|
7320
|
+
mentions: z12.array(
|
|
7321
|
+
z12.object({
|
|
7322
|
+
kind: z12.enum(["character", "product", "location"]),
|
|
7154
7323
|
id: slug.describe("The slug, exactly as the token in the prompt carries it."),
|
|
7155
|
-
name:
|
|
7324
|
+
name: z12.string().max(200).optional()
|
|
7156
7325
|
})
|
|
7157
7326
|
).max(10).optional().describe("Every mention token of the prompt (at most 10). The returned mentions carry the names your company gave them."),
|
|
7158
|
-
model:
|
|
7327
|
+
model: z12.string().optional().describe('Optional. The image or video model the prompt will be rendered with (e.g. "kie/nano-banana-2"), so the rewrite suits it. It must make the target.'),
|
|
7159
7328
|
brandSlug: slug.optional().describe("Optional. A brand of your company whose style the rewrite should follow."),
|
|
7160
|
-
brandMode:
|
|
7329
|
+
brandMode: z12.string().optional().describe('Optional brand mode (e.g. "hero"). Only meaningful with brandSlug.')
|
|
7161
7330
|
},
|
|
7162
7331
|
annotations: { readOnlyHint: true },
|
|
7163
7332
|
handler: async (args, ctx) => {
|
|
@@ -7172,7 +7341,7 @@ var studioPromptEnhance = defineTool({
|
|
|
7172
7341
|
}
|
|
7173
7342
|
});
|
|
7174
7343
|
var LIKENESS_REFUSAL = `${LIKENESS_CONFIRMATION_REQUIRED_CODE}: ${likenessConfirmationRequiredMessage()}`;
|
|
7175
|
-
var likenessRightsConfirmed =
|
|
7344
|
+
var likenessRightsConfirmed = z12.literal(true, { error: LIKENESS_REFUSAL }).describe(likenessConfirmationToolDescription());
|
|
7176
7345
|
function assertLikenessRightsConfirmed(value) {
|
|
7177
7346
|
if (!isLikenessRightsConfirmed(value)) throw new Error(LIKENESS_REFUSAL);
|
|
7178
7347
|
}
|
|
@@ -7180,11 +7349,11 @@ var studioCreateCharacter = defineTool({
|
|
|
7180
7349
|
name: "studio_create_character",
|
|
7181
7350
|
description: "Create an empty character record (no reference images yet). Prefer studio_mint_character, which generates the 7-view identity sheet and freezes it as references in one call. Use this only when you will upload your own reference images. Requires likenessRightsConfirmed: true, which you may only pass after the human you act for confirmed it for this character. Fails with 409 (code slug_taken) only if your own company already has a character with this slug; a slug another company uses is free to take.",
|
|
7182
7351
|
inputSchema: {
|
|
7183
|
-
name:
|
|
7352
|
+
name: z12.string().min(1).describe('Display name, e.g. "Bruno Hartmann".'),
|
|
7184
7353
|
slug,
|
|
7185
|
-
descriptorPrompt:
|
|
7186
|
-
negativePrompt:
|
|
7187
|
-
defaultModel:
|
|
7354
|
+
descriptorPrompt: z12.string().min(1).describe("The identity description prepended to every generation that uses this character."),
|
|
7355
|
+
negativePrompt: z12.string().optional(),
|
|
7356
|
+
defaultModel: z12.string().optional().describe("Default image model id for this character."),
|
|
7188
7357
|
likenessRightsConfirmed
|
|
7189
7358
|
},
|
|
7190
7359
|
handler: async (args, ctx) => {
|
|
@@ -7204,16 +7373,16 @@ var studioMintCharacter = defineTool({
|
|
|
7204
7373
|
name: "studio_mint_character",
|
|
7205
7374
|
description: "Mint a consistent character from a text description: runs the curated character-sheet workflow (seed face with fal/nano-banana-2, then six identity-pinned edits with fal/nano-banana-2-edit: three-quarter, profile, full-body, close-up, warm lighting, cool lighting), waits for it, creates the character, and uploads the 7 views as frozen references with the right categories. Returns the slug, reference count, per-view URLs, the runId and total cost (about $0.30). The description should cover face, hair, age, build and distinguishing features; wardrobe is standardized to a plain gray tee. Takes 2 to 5 minutes. Requires likenessRightsConfirmed: true, which you may only pass after the human you act for confirmed it for this character; without it the tool refuses before the run starts, so nothing is spent.",
|
|
7206
7375
|
inputSchema: {
|
|
7207
|
-
projectId:
|
|
7208
|
-
name:
|
|
7376
|
+
projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
|
|
7377
|
+
name: z12.string().min(1).describe("Display name."),
|
|
7209
7378
|
slug,
|
|
7210
|
-
description:
|
|
7211
|
-
descriptorPrompt:
|
|
7212
|
-
negativePrompt:
|
|
7213
|
-
defaultModel:
|
|
7214
|
-
seedModel:
|
|
7215
|
-
viewModel:
|
|
7216
|
-
visibility:
|
|
7379
|
+
description: z12.string().min(10).describe("Seed identity description (face, hair, age, build, distinguishing features)."),
|
|
7380
|
+
descriptorPrompt: z12.string().optional().describe("Override for the character's stored descriptor prompt. Defaults to the description."),
|
|
7381
|
+
negativePrompt: z12.string().optional(),
|
|
7382
|
+
defaultModel: z12.string().optional(),
|
|
7383
|
+
seedModel: z12.string().optional().describe("Override the seed text-to-image model (default fal/nano-banana-2)."),
|
|
7384
|
+
viewModel: z12.string().optional().describe("Override the view image-edit model (default fal/nano-banana-2-edit)."),
|
|
7385
|
+
visibility: z12.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
|
|
7217
7386
|
likenessRightsConfirmed,
|
|
7218
7387
|
waitSeconds
|
|
7219
7388
|
},
|
|
@@ -7272,12 +7441,12 @@ var studioCreateBrand = defineTool({
|
|
|
7272
7441
|
name: "studio_create_brand",
|
|
7273
7442
|
description: "Create a brand (a style preset: name, slug, optional style prefix prepended to every prompt, optional free-text context). Upload reference images afterwards with studio_upload_brand_reference. Fails with 409 (code slug_taken) only if your own company already has a brand with this slug; a slug another company uses is free to take.",
|
|
7274
7443
|
inputSchema: {
|
|
7275
|
-
name:
|
|
7444
|
+
name: z12.string().min(1),
|
|
7276
7445
|
slug,
|
|
7277
|
-
stylePrefix:
|
|
7278
|
-
context:
|
|
7279
|
-
defaultModel:
|
|
7280
|
-
maxReferenceImages:
|
|
7446
|
+
stylePrefix: z12.string().optional().describe("Text prepended to every prompt generated under this brand."),
|
|
7447
|
+
context: z12.string().optional().describe("Markdown brand context (tone, palette, do/don't)."),
|
|
7448
|
+
defaultModel: z12.string().optional(),
|
|
7449
|
+
maxReferenceImages: z12.number().int().min(0).max(8).optional()
|
|
7281
7450
|
},
|
|
7282
7451
|
handler: async (args, ctx) => {
|
|
7283
7452
|
const { config } = await ctx.client.createBrand({
|
|
@@ -7296,11 +7465,11 @@ var studioUploadBrandReference = defineTool({
|
|
|
7296
7465
|
description: `Upload one reference image to a brand's library from a local file path or an http(s) URL. The Studio converts it to a 512px WebP and injects it into generations under that brand (up to the brand's maxReferenceImages). Category groups references (default "general"); tags and a 1 to 10 quality score are optional.`,
|
|
7297
7466
|
inputSchema: {
|
|
7298
7467
|
brandSlug: slug.describe("The slug of a brand of your company (from studio_create_brand). A slug that names no brand of your company is a 404, and nothing is uploaded."),
|
|
7299
|
-
source:
|
|
7300
|
-
category:
|
|
7301
|
-
label:
|
|
7302
|
-
tags:
|
|
7303
|
-
score:
|
|
7468
|
+
source: z12.string().min(1).describe("Local file path or http(s) URL of an image."),
|
|
7469
|
+
category: z12.string().optional().describe('Library category, default "general".'),
|
|
7470
|
+
label: z12.string().optional().describe("Optional file name / label."),
|
|
7471
|
+
tags: z12.array(z12.string()).optional(),
|
|
7472
|
+
score: z12.number().int().min(1).max(10).optional()
|
|
7304
7473
|
},
|
|
7305
7474
|
handler: async (args, ctx) => {
|
|
7306
7475
|
const file = await loadImageSource(args.source, ctx.client);
|
|
@@ -7321,26 +7490,26 @@ var studioRunWorkflow = defineTool({
|
|
|
7321
7490
|
name: "studio_run_workflow",
|
|
7322
7491
|
description: `Run a generation workflow DAG. Pass an inline definition (nodes of provider calls wired by ref bindings; this is what the hosted Studio accepts) or the savedId of a workflow saved in the Studio (the Studio runs that workflow's current document, exactly what the canvas would run). Params fill {kind:"param"} bindings. Returns the runId plus per-node status, URLs and cost; with wait=true (default) it blocks until the run is terminal (succeeded, failed, partial, cancelled). Each node becomes a paid job. Use an inline definition ONLY for the first batch of a new deliverable (one workflow, a node per item, a stable label); a follow-up on an existing item belongs in that saved workflow as a new node (studio_workflow_apply: addNode plus connect from the node it refines) run here with savedId and nodeIds, because every listed inline run is saved as its own workflow. A clip with both a start and an end frame is checked for continuity before it is paid for (see acknowledgeContinuity).`,
|
|
7323
7492
|
inputSchema: {
|
|
7324
|
-
projectId:
|
|
7493
|
+
projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
|
|
7325
7494
|
definition: workflowDefinitionSchema.optional(),
|
|
7326
|
-
savedId:
|
|
7327
|
-
params:
|
|
7328
|
-
nodeIds:
|
|
7329
|
-
upstreamGenerations:
|
|
7495
|
+
savedId: z12.string().optional().describe("Id of a saved workflow (from studio_workflow_create, studio_workflow_get or a listed run) to run instead of an inline definition. An unknown id is a 404 naming it; a workflow that is not runnable yet comes back as not_runnable with per-node issues."),
|
|
7496
|
+
params: z12.record(z12.string(), z12.unknown()).optional().describe("Values for the definition's params."),
|
|
7497
|
+
nodeIds: z12.array(z12.string()).optional().describe("Run only this subset of nodes (requires an inline `definition` or a `savedId`)."),
|
|
7498
|
+
upstreamGenerations: z12.record(z12.string(), z12.string()).optional().describe(
|
|
7330
7499
|
'Pin WHICH generation of an upstream node feeds this subset run: { "<upstream node id>": "<node-run id>" } (the per-node `id` that studio_get_run returns). A verified pin is reused even when the planner has no matching cache key for it (an inline first batch, or a node edited and reverted), so a follow-up node wired from an earlier generation runs against exactly that image. An unknown id is refused naming the node, never silently replaced by the latest.'
|
|
7331
7500
|
),
|
|
7332
|
-
runs:
|
|
7333
|
-
visibility:
|
|
7334
|
-
budgetUsd:
|
|
7501
|
+
runs: z12.number().int().min(1).max(8).optional().describe("Repeat a node subset N times (1 to 8)."),
|
|
7502
|
+
visibility: z12.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
|
|
7503
|
+
budgetUsd: z12.number().nonnegative().optional().describe(
|
|
7335
7504
|
'S6b: hard cap on the estimated cost, verified server-side before anything is created. An unverifiable estimate (a credits-only or unpriced executing node) refuses too, never proceeds silently. Refusal: { code: "budget_exceeded", estimate }. For `runs`>1 this is the AGGREGATE cap across every iteration.'
|
|
7336
7505
|
),
|
|
7337
|
-
confirm:
|
|
7506
|
+
confirm: z12.boolean().optional().describe(
|
|
7338
7507
|
'S6b: bypasses the confirmation threshold for this one request (a flat $10 today) when the estimate meets or exceeds it. Without this, such a run refuses with { code: "confirmation_required", estimate }.'
|
|
7339
7508
|
),
|
|
7340
|
-
acknowledgeContinuity:
|
|
7509
|
+
acknowledgeContinuity: z12.boolean().optional().describe(
|
|
7341
7510
|
'Run despite the continuity check. Before a run executes an image-to-video node with BOTH a start frame (inputImageUrl) and an end frame (endImageUrl), the Studio compares the two frames with a vision model (one small paid check per new pair of frames, remembered for your company, so an unchanged pair is never charged twice): a person or a held object in one frame and not the other makes the video model invent or erase it mid-clip. Frames that disagree refuse with { code: "continuity_mismatch", nodes: [{ nodeId, differences }] }; a check that could not run refuses with { code: "continuity_unchecked", nodes: [{ nodeId, reason }] }. Nothing is spent on either. Show the differences to the person you act for and fix the frames; pass true only when they decide to run anyway.'
|
|
7342
7511
|
),
|
|
7343
|
-
wait:
|
|
7512
|
+
wait: z12.boolean().default(true),
|
|
7344
7513
|
waitSeconds
|
|
7345
7514
|
},
|
|
7346
7515
|
handler: async (args, ctx) => {
|
|
@@ -7372,8 +7541,8 @@ var studioGetRun = defineTool({
|
|
|
7372
7541
|
name: "studio_get_run",
|
|
7373
7542
|
description: "Fetch a workflow run by runId: overall status (pending, running, succeeded, failed, partial, awaiting_decision, cancelled; cancelled means somebody stopped it), total cost, and per-node status, result URL, cost and error message. Set wait=true to block until the run settles. A run at awaiting_decision is parked on a person at a judge node: waiting returns immediately with a `waiting` block naming the node and its candidates, because polling can never clear it; ask the user to choose and submit their answer with studio_decide_judge.",
|
|
7374
7543
|
inputSchema: {
|
|
7375
|
-
runId:
|
|
7376
|
-
wait:
|
|
7544
|
+
runId: z12.string().min(1),
|
|
7545
|
+
wait: z12.boolean().default(false),
|
|
7377
7546
|
waitSeconds
|
|
7378
7547
|
},
|
|
7379
7548
|
annotations: { readOnlyHint: true },
|
|
@@ -7386,11 +7555,11 @@ var studioDecideJudge = defineTool({
|
|
|
7386
7555
|
name: "studio_decide_judge",
|
|
7387
7556
|
description: "Submit a PERSON'S decision on a parked judge node (a run whose status is awaiting_decision). Approving that candidate resumes the run from that node; rejecting fails the node and stops the branch. Never call this on your own judgement: a judge node exists precisely because a human is meant to look, so show them the candidates from studio_get_run's `waiting` block and pass on the answer they give. `candidate.generationId` comes from that same block, and may be omitted only when the node has exactly one candidate.",
|
|
7388
7557
|
inputSchema: {
|
|
7389
|
-
runId:
|
|
7390
|
-
nodeId:
|
|
7391
|
-
verdict:
|
|
7392
|
-
candidate:
|
|
7393
|
-
reason:
|
|
7558
|
+
runId: z12.string().min(1),
|
|
7559
|
+
nodeId: z12.string().min(1),
|
|
7560
|
+
verdict: z12.enum(["approved", "rejected"]),
|
|
7561
|
+
candidate: z12.object({ generationId: z12.string().min(1), index: z12.number().int().min(0).optional() }).optional(),
|
|
7562
|
+
reason: z12.string().max(500).optional()
|
|
7394
7563
|
},
|
|
7395
7564
|
annotations: { destructiveHint: false, idempotentHint: false },
|
|
7396
7565
|
handler: async (args, ctx) => {
|
|
@@ -7406,8 +7575,8 @@ var studioGetRunOutput = defineTool({
|
|
|
7406
7575
|
name: "studio_get_run_output",
|
|
7407
7576
|
description: "Get a FRESH signed URL for one node's output of a workflow run (signed URLs expire; call this when an earlier URL stopped working). Returns url, kind (image, video, model3d) and mime.",
|
|
7408
7577
|
inputSchema: {
|
|
7409
|
-
runId:
|
|
7410
|
-
nodeId:
|
|
7578
|
+
runId: z12.string().min(1),
|
|
7579
|
+
nodeId: z12.string().min(1)
|
|
7411
7580
|
},
|
|
7412
7581
|
annotations: { readOnlyHint: true },
|
|
7413
7582
|
handler: async (args, ctx) => {
|
|
@@ -7419,22 +7588,22 @@ var studioReplaceCharacterInVideo = defineTool({
|
|
|
7419
7588
|
name: "studio_replace_character_in_video",
|
|
7420
7589
|
description: 'Put a minted character into a video shot through the still-swap route: (1) an image-edit node (fal/nano-banana-2-edit) replaces the person in a scene FRAME with the character; (2) an image-to-video node animates that still (default fal/seedance-pro-image-to-video; with endFrameUrl it switches to fal/kling-v2-5-image-to-video and binds the end keyframe so the clip lands on it). Be honest with the user about what this route is: the video step REGENERATES the motion from the stills, so the original performance, timing and background are recreated rather than preserved; when the original motion must survive exactly, say so before spending. Declare scope: identity (default) takes face, head and hair and keeps the footage body; full_body also takes the character body proportions, which changes the silhouette. Pass preserve with the two or three shot-specific constraints most likely to fail, from looking at the frame (e.g. "keep the open door in front of his body", "match the face soft focus"), or a complete swapPrompt of your own. Never add a realism suffix like "photorealistic" or a promise that every pixel stays identical; the model cannot keep either and the suffix sharpens deliberately soft subjects. Give the character as characterSlug (its full-body reference is used, falling back to three-quarter then face) or as an explicit characterReferenceUrl. Requires a frame URL: extract a representative frame from the video yourself first (this tool does not decode video). Waits for both nodes and returns stillUrl, videoUrl, runId and costUsd (what the take cost your company; about $1.05 with the default models on prepaid credits without a subscription). Inspect the still before paying for more takes, keep generated cuts under 5 seconds, and budget one take plus two retries per shot. Do not use video-to-video swap models on dark or handheld footage.',
|
|
7421
7590
|
inputSchema: {
|
|
7422
|
-
projectId:
|
|
7591
|
+
projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
|
|
7423
7592
|
sceneFrameUrl: httpUrl.describe("Public or signed URL of ONE frame of the target shot (png/jpg)."),
|
|
7424
7593
|
characterSlug: slug.optional().describe(
|
|
7425
7594
|
"Character to insert: one of your company's, or one another company shared. Its full-body reference (fallback three-quarter, face) is resolved automatically. A slug your company cannot use is a 404 before the run starts, so nothing is spent."
|
|
7426
7595
|
),
|
|
7427
7596
|
characterReferenceUrl: httpUrl.optional().describe("Explicit character reference image URL (use instead of characterSlug)."),
|
|
7428
7597
|
endFrameUrl: httpUrl.optional().describe("Optional second approved keyframe for the END of the clip. Switches the video model to Kling (start + end frame) unless videoModel is set explicitly."),
|
|
7429
|
-
scope:
|
|
7430
|
-
preserve:
|
|
7431
|
-
swapPrompt:
|
|
7432
|
-
motionPrompt:
|
|
7433
|
-
videoModel:
|
|
7434
|
-
editModel:
|
|
7435
|
-
aspectRatio:
|
|
7436
|
-
visibility:
|
|
7437
|
-
acknowledgeContinuity:
|
|
7598
|
+
scope: z12.enum(SWAP_SCOPES).optional().describe("How much of the person to replace. identity (default): face, head and hair from the character, the footage keeps its body. full_body: also the character body proportions; the silhouette changes, so the background behind the old body and every contact point must be re-derived."),
|
|
7599
|
+
preserve: z12.array(z12.string().min(1).max(200)).max(6).optional().describe('Shot-specific constraints most likely to fail, as concrete relationships seen in the frame, one per entry (e.g. "keep the open door in front of his body"). Appended to the composed prompt.'),
|
|
7600
|
+
swapPrompt: z12.string().optional().describe("A complete still-swap edit prompt of your own; replaces the composed one, so scope and preserve are then ignored."),
|
|
7601
|
+
motionPrompt: z12.string().optional().describe("Override the motion description for the video node."),
|
|
7602
|
+
videoModel: z12.string().optional().describe(`Image-to-video model id. Default ${DEFAULT_SWAP_VIDEO_MODEL}, or ${KEYFRAME_SWAP_VIDEO_MODEL} when endFrameUrl is given.`),
|
|
7603
|
+
editModel: z12.string().default(DEFAULT_SWAP_EDIT_MODEL).describe("Image-edit model id for the still swap."),
|
|
7604
|
+
aspectRatio: z12.string().default("16:9"),
|
|
7605
|
+
visibility: z12.enum(["listed", "unlisted"]).optional(),
|
|
7606
|
+
acknowledgeContinuity: z12.boolean().optional().describe(
|
|
7438
7607
|
"With endFrameUrl only. The swapped still (the clip's start frame) is compared with the end frame before the clip is paid for; when they do not show the same people and the same objects in their hands, the video node fails with continuity_mismatch and the differences, and nothing is spent on the clip (the still was already made). Fix the end frame, or call again with true when the person you act for decides to run anyway."
|
|
7439
7608
|
),
|
|
7440
7609
|
waitSeconds
|
|
@@ -7502,7 +7671,7 @@ var studioGetSpend = defineTool({
|
|
|
7502
7671
|
name: "studio_get_spend",
|
|
7503
7672
|
description: `Read the spend ledger: total USD and job counts for today, the last 7 days and the last 30 days, plus the most recent paid actions. The amounts are what the company paid (each job's costUsd): for a company on prepaid credits, what left its balance for those jobs. tzOffsetMinutes is the viewer's Date.getTimezoneOffset() so "today" rolls at local midnight (default UTC).`,
|
|
7504
7673
|
inputSchema: {
|
|
7505
|
-
tzOffsetMinutes:
|
|
7674
|
+
tzOffsetMinutes: z12.number().int().min(-840).max(840).optional()
|
|
7506
7675
|
},
|
|
7507
7676
|
annotations: { readOnlyHint: true },
|
|
7508
7677
|
handler: async (args, ctx) => {
|
|
@@ -7530,7 +7699,7 @@ var studioDescribePublished = defineTool({
|
|
|
7530
7699
|
name: "studio_describe_published",
|
|
7531
7700
|
description: "Describe one published recipe by slug: { slug, definition, hasEffects }. definition is the FROZEN workflow (params, node shapes) exactly as it was at publish time, never the live authoring document, which may have moved on since. Read this before studio_run_published to know what params it needs. Free, read-only.",
|
|
7532
7701
|
inputSchema: {
|
|
7533
|
-
slug:
|
|
7702
|
+
slug: z12.string().min(1).describe("The recipe slug, from studio_list_published.")
|
|
7534
7703
|
},
|
|
7535
7704
|
annotations: { readOnlyHint: true },
|
|
7536
7705
|
handler: async (args, ctx) => {
|
|
@@ -7542,20 +7711,20 @@ var studioRunPublished = defineTool({
|
|
|
7542
7711
|
name: "studio_run_published",
|
|
7543
7712
|
description: `Run a published recipe by slug. Runs its FROZEN definition (studio_describe_published shows exactly what it needs); params fill the definition's own {kind:"param"} bindings. On success, the recipe's declared post-run effects fire automatically (e.g. character minting creates the character and attaches its reference views); effects never fire on a failed or partial run, by design. A recipe that creates a character (hasEffects, see studio_describe_published) requires likenessRightsConfirmed: true and refuses with { code: "likeness_rights_confirmation_required" } before anything is spent when it is missing. Returns the runId plus per-node status, URLs and cost; with wait=true (default) it blocks until the run is terminal. Each node becomes a paid job. The same $10 confirm-gate as studio_run_workflow applies: an estimate at or over the threshold refuses with { code: "confirmation_required", estimate } unless confirm: true is set. So does its continuity check before a clip with a start and an end frame (see acknowledgeContinuity).`,
|
|
7544
7713
|
inputSchema: {
|
|
7545
|
-
slug:
|
|
7546
|
-
projectId:
|
|
7547
|
-
params:
|
|
7548
|
-
budgetUsd:
|
|
7714
|
+
slug: z12.string().min(1).describe("The recipe slug, from studio_list_published."),
|
|
7715
|
+
projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
|
|
7716
|
+
params: z12.record(z12.string(), z12.unknown()).optional().describe("Values for the recipe's params (see studio_describe_published)."),
|
|
7717
|
+
budgetUsd: z12.number().nonnegative().optional().describe(
|
|
7549
7718
|
'Hard cap on the estimated cost, verified server-side before anything is created. An unverifiable estimate (a credits-only or unpriced executing node) refuses too. Refusal: { code: "budget_exceeded", estimate }.'
|
|
7550
7719
|
),
|
|
7551
|
-
confirm:
|
|
7720
|
+
confirm: z12.boolean().optional().describe(
|
|
7552
7721
|
'Bypasses the confirmation threshold for this one request (a flat $10 today) when the estimate meets or exceeds it. Without this, such a run refuses with { code: "confirmation_required", estimate }.'
|
|
7553
7722
|
),
|
|
7554
|
-
likenessRightsConfirmed:
|
|
7555
|
-
acknowledgeContinuity:
|
|
7723
|
+
likenessRightsConfirmed: z12.literal(true).optional().describe(`Required when the recipe creates a character; ignored otherwise. ${likenessConfirmationToolDescription()}`),
|
|
7724
|
+
acknowledgeContinuity: z12.boolean().optional().describe(
|
|
7556
7725
|
'Run despite the continuity check, exactly as on studio_run_workflow: a recipe with an image-to-video node that has both a start and an end frame refuses with { code: "continuity_mismatch", nodes: [{ nodeId, differences }] } or { code: "continuity_unchecked", nodes: [{ nodeId, reason }] } before anything is spent. Pass true only when the person you act for decides to run anyway.'
|
|
7557
7726
|
),
|
|
7558
|
-
wait:
|
|
7727
|
+
wait: z12.boolean().default(true),
|
|
7559
7728
|
waitSeconds
|
|
7560
7729
|
},
|
|
7561
7730
|
handler: async (args, ctx) => {
|
|
@@ -7598,7 +7767,8 @@ var TOOLS = [
|
|
|
7598
7767
|
studioGetUsage,
|
|
7599
7768
|
...WORKFLOW_TOOLS,
|
|
7600
7769
|
...MANAGE_TOOLS,
|
|
7601
|
-
...COMPOSITION_TOOLS
|
|
7770
|
+
...COMPOSITION_TOOLS,
|
|
7771
|
+
...PROMPT_TOOLS
|
|
7602
7772
|
];
|
|
7603
7773
|
var TOOL_NAMES = TOOLS.map((t) => t.name);
|
|
7604
7774
|
function toolResult(value) {
|
|
@@ -7616,7 +7786,7 @@ function toolError(message) {
|
|
|
7616
7786
|
}
|
|
7617
7787
|
async function invokeTool(def, args, ctx) {
|
|
7618
7788
|
try {
|
|
7619
|
-
const parsed =
|
|
7789
|
+
const parsed = z12.object(def.inputSchema).parse(args ?? {});
|
|
7620
7790
|
const value = await def.handler(parsed, ctx);
|
|
7621
7791
|
return toolResult(value);
|
|
7622
7792
|
} catch (err) {
|
|
@@ -7667,7 +7837,7 @@ function registerTools(server, base) {
|
|
|
7667
7837
|
|
|
7668
7838
|
// src/server.ts
|
|
7669
7839
|
var SERVER_NAME = "lumitra-studio";
|
|
7670
|
-
var SERVER_VERSION = "0.
|
|
7840
|
+
var SERVER_VERSION = "0.16.0";
|
|
7671
7841
|
function createStudioMcpServer(opts = {}) {
|
|
7672
7842
|
const config = opts.config ?? resolveConfig(opts.env ?? process.env);
|
|
7673
7843
|
const client = new StudioClient(config, {
|