@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/dist/cli.js CHANGED
@@ -195,6 +195,25 @@ var StudioClient = class {
195
195
  deleteCampaign(campaignId) {
196
196
  return this.json("DELETE", `/api/campaigns/${encodeURIComponent(campaignId)}`);
197
197
  }
198
+ // ── Saved prompts ("My prompts", company-wide) ──
199
+ listSavedPrompts(opts = {}) {
200
+ const q = new URLSearchParams();
201
+ if (opts.sort) q.set("sort", opts.sort);
202
+ if (opts.limit !== void 0) q.set("limit", String(opts.limit));
203
+ if (opts.offset !== void 0) q.set("offset", String(opts.offset));
204
+ const qs = q.toString();
205
+ return this.json("GET", `/api/v1/prompts${qs ? `?${qs}` : ""}`);
206
+ }
207
+ getSavedPrompt(promptId) {
208
+ return this.json("GET", `/api/v1/prompts/${encodeURIComponent(promptId)}`);
209
+ }
210
+ /** 201 saved; 200 with `alreadySaved: true` when the company already saved the same recipe. */
211
+ savePrompt(body) {
212
+ return this.json("POST", "/api/v1/prompts", { json: body });
213
+ }
214
+ deleteSavedPrompt(promptId) {
215
+ return this.json("DELETE", `/api/v1/prompts/${encodeURIComponent(promptId)}`);
216
+ }
198
217
  // ── Generation jobs ──
199
218
  /**
200
219
  * One image job. `brandSlug` is optional: without it the image is generated
@@ -533,7 +552,7 @@ function projectQuery(projectId) {
533
552
  }
534
553
 
535
554
  // src/tools.ts
536
- import { z as z11 } from "zod";
555
+ import { z as z12 } from "zod";
537
556
 
538
557
  // ../lumitra-core/dist/models/index.js
539
558
  var veo = (tier, label) => {
@@ -1494,7 +1513,23 @@ var CATALOG_ENTRIES = [
1494
1513
  modality: "audio",
1495
1514
  task: "text-to-speech",
1496
1515
  label: "ElevenLabs Multilingual v2 (TTS)",
1497
- description: "ElevenLabs Multilingual v2 text-to-speech. 99+ languages, brand-voice cloning capable. Default text-to-speech. Returns mp3 bytes synchronously.",
1516
+ 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.",
1517
+ // ElevenLabs' text-to-speech API (voice_settings, checked 2026-10-25):
1518
+ // stability and similarity_boost run from 0 to 1 with defaults 0.5 and
1519
+ // 0.75; speed from 0.7 to 1.2 with 1 as the normal pace (its help center
1520
+ // states the bounds). Multilingual v2 takes 10,000 characters per request
1521
+ // (its models page). `speechRequestRefusal` refuses anything outside these
1522
+ // before a request is admitted.
1523
+ capabilities: {
1524
+ speech: {
1525
+ maxCharacters: 1e4,
1526
+ voiceSettings: {
1527
+ stability: { min: 0, max: 1, step: 0.05, default: 0.5 },
1528
+ similarityBoost: { min: 0, max: 1, step: 0.05, default: 0.75 },
1529
+ speed: { min: 0.7, max: 1.2, step: 0.05, default: 1 }
1530
+ }
1531
+ }
1532
+ },
1498
1533
  isDefault: true
1499
1534
  },
1500
1535
  {
@@ -1558,14 +1593,20 @@ var CATALOG_ENTRIES = [
1558
1593
  modality: "image",
1559
1594
  task: "text-to-image",
1560
1595
  label: "Gemini 2.5 Flash Image",
1561
- 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."
1596
+ 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.",
1597
+ // Google's model page (read 2026-10-25): "Maximum images per prompt: 3".
1598
+ // The adapter sends every image inline, downloading Studio references
1599
+ // first (providers/vertex.ts), up to 7 MB each.
1600
+ capabilities: { maxInputImages: 3 }
1562
1601
  },
1563
1602
  {
1564
1603
  id: "vertex/gemini-3-pro-image-preview",
1565
1604
  provider: "vertex",
1566
1605
  modality: "image",
1567
1606
  task: "text-to-image",
1568
- label: "Nano Banana Pro (preview)"
1607
+ label: "Nano Banana Pro (preview)",
1608
+ // Google's model page for Gemini 3 Pro Image (read 2026-10-25): "Maximum images per prompt: 14".
1609
+ capabilities: { maxInputImages: 14 }
1569
1610
  },
1570
1611
  {
1571
1612
  id: "vertex/gemini-3-1-flash-image-preview",
@@ -1573,7 +1614,9 @@ var CATALOG_ENTRIES = [
1573
1614
  modality: "image",
1574
1615
  task: "text-to-image",
1575
1616
  label: "Gemini 3.1 Flash Image (preview)",
1576
- description: "Vertex AI direct, newest flash variant. Global region. Preview status."
1617
+ description: "Vertex AI direct, newest flash variant. Global region. Preview status.",
1618
+ // Google's model page for Gemini 3.1 Flash Image (read 2026-10-25): "Maximum images per prompt: 14".
1619
+ capabilities: { maxInputImages: 14 }
1577
1620
  }
1578
1621
  ];
1579
1622
  var PINNED_FAL_NOTE = "Pinned to fal: a job on this entry never goes to KIE.";
@@ -2052,6 +2095,12 @@ var VIDEO_MAX_SECONDS_AT_RESOLUTION = {
2052
2095
  [LTX_25_FAST_I2V_ENDPOINT]: { "4k": 10 }
2053
2096
  };
2054
2097
  var VIDEO_UNSUPPORTED_PARAMS = {
2098
+ // Kling 2.5 Turbo and Seedance 1.0 Pro render silent clips and their schemas
2099
+ // declare no audio field at all (fal model schemas, checked 2026-10-25), so a
2100
+ // sound choice is refused before submit instead of being sent and ignored.
2101
+ "fal-ai/kling-video/v2.5-turbo/pro/image-to-video": ["generateAudio"],
2102
+ "fal-ai/bytedance/seedance/v1/pro/image-to-video": ["generateAudio"],
2103
+ "fal-ai/bytedance/seedance/v1/pro/text-to-video": ["generateAudio"],
2055
2104
  // Kling O3 Edit follows the source clip: its length, frame, size and look are
2056
2105
  // the source's, and the endpoint declares none of these knobs. A duration in
2057
2106
  // particular would only have been a (wrong) billing figure; the completer
@@ -2098,6 +2147,22 @@ var VIDEO_UNSUPPORTED_PARAMS = {
2098
2147
  [KLING_O3_PRO_R2V_ENDPOINT]: ["resolution", "seed", "negativePrompt"],
2099
2148
  ...Object.fromEntries(LTX_25_I2V_ENDPOINTS.map((e) => [e, ["seed", "negativePrompt"]]))
2100
2149
  };
2150
+ var VIDEO_AUDIO_SWITCH = {
2151
+ ...Object.fromEntries(VEO_ENDPOINTS.map((e) => [e, { default: false }])),
2152
+ [KLING_26_I2V_ENDPOINT]: { default: false },
2153
+ ...Object.fromEntries(KLING_O3_I2V_ENDPOINTS.map((e) => [e, { default: false }])),
2154
+ [KLING_O3_PRO_R2V_ENDPOINT]: { default: false },
2155
+ "bytedance/seedance-2.5/image-to-video": { default: true },
2156
+ "bytedance/seedance-2.0/image-to-video": { default: true },
2157
+ [WAN_30_I2V_ENDPOINT]: { default: true },
2158
+ ...Object.fromEntries(LTX_25_I2V_ENDPOINTS.map((e) => [e, { default: true }])),
2159
+ "blackforestlabs/flux-3/image-to-video/draft": { default: true },
2160
+ "blackforestlabs/flux-3/first-last-frame-to-video/draft": { default: true },
2161
+ "blackforestlabs/flux-3/keyframes-to-video/draft": { default: true },
2162
+ "blackforestlabs/flux-3/image-to-video": { default: true },
2163
+ "blackforestlabs/flux-3/first-last-frame-to-video": { default: true },
2164
+ "blackforestlabs/flux-3/keyframes-to-video": { default: true }
2165
+ };
2101
2166
  var ROWS = [
2102
2167
  [0, "Idle", "DailyActions", "Idle"],
2103
2168
  [1, "Walking_Woman", "WalkAndRun", "Walking"],
@@ -4153,7 +4218,23 @@ var CATALOG_ENTRIES2 = [
4153
4218
  modality: "audio",
4154
4219
  task: "text-to-speech",
4155
4220
  label: "ElevenLabs Multilingual v2 (TTS)",
4156
- description: "ElevenLabs Multilingual v2 text-to-speech. 99+ languages, brand-voice cloning capable. Default text-to-speech. Returns mp3 bytes synchronously.",
4221
+ 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.",
4222
+ // ElevenLabs' text-to-speech API (voice_settings, checked 2026-10-25):
4223
+ // stability and similarity_boost run from 0 to 1 with defaults 0.5 and
4224
+ // 0.75; speed from 0.7 to 1.2 with 1 as the normal pace (its help center
4225
+ // states the bounds). Multilingual v2 takes 10,000 characters per request
4226
+ // (its models page). `speechRequestRefusal` refuses anything outside these
4227
+ // before a request is admitted.
4228
+ capabilities: {
4229
+ speech: {
4230
+ maxCharacters: 1e4,
4231
+ voiceSettings: {
4232
+ stability: { min: 0, max: 1, step: 0.05, default: 0.5 },
4233
+ similarityBoost: { min: 0, max: 1, step: 0.05, default: 0.75 },
4234
+ speed: { min: 0.7, max: 1.2, step: 0.05, default: 1 }
4235
+ }
4236
+ }
4237
+ },
4157
4238
  isDefault: true
4158
4239
  },
4159
4240
  {
@@ -4217,14 +4298,20 @@ var CATALOG_ENTRIES2 = [
4217
4298
  modality: "image",
4218
4299
  task: "text-to-image",
4219
4300
  label: "Gemini 2.5 Flash Image",
4220
- 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."
4301
+ 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.",
4302
+ // Google's model page (read 2026-10-25): "Maximum images per prompt: 3".
4303
+ // The adapter sends every image inline, downloading Studio references
4304
+ // first (providers/vertex.ts), up to 7 MB each.
4305
+ capabilities: { maxInputImages: 3 }
4221
4306
  },
4222
4307
  {
4223
4308
  id: "vertex/gemini-3-pro-image-preview",
4224
4309
  provider: "vertex",
4225
4310
  modality: "image",
4226
4311
  task: "text-to-image",
4227
- label: "Nano Banana Pro (preview)"
4312
+ label: "Nano Banana Pro (preview)",
4313
+ // Google's model page for Gemini 3 Pro Image (read 2026-10-25): "Maximum images per prompt: 14".
4314
+ capabilities: { maxInputImages: 14 }
4228
4315
  },
4229
4316
  {
4230
4317
  id: "vertex/gemini-3-1-flash-image-preview",
@@ -4232,7 +4319,9 @@ var CATALOG_ENTRIES2 = [
4232
4319
  modality: "image",
4233
4320
  task: "text-to-image",
4234
4321
  label: "Gemini 3.1 Flash Image (preview)",
4235
- description: "Vertex AI direct, newest flash variant. Global region. Preview status."
4322
+ description: "Vertex AI direct, newest flash variant. Global region. Preview status.",
4323
+ // Google's model page for Gemini 3.1 Flash Image (read 2026-10-25): "Maximum images per prompt: 14".
4324
+ capabilities: { maxInputImages: 14 }
4236
4325
  }
4237
4326
  ];
4238
4327
  var PINNED_FAL_NOTE2 = "Pinned to fal: a job on this entry never goes to KIE.";
@@ -5870,7 +5959,7 @@ var studioWorkflowDescribe = defineTool({
5870
5959
  inputSchema: {
5871
5960
  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.'),
5872
5961
  includeSettings: z7.boolean().default(false).describe("Include each task's settings knobs (key, type, range, default)."),
5873
- 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? }.")
5962
+ 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.")
5874
5963
  },
5875
5964
  annotations: { readOnlyHint: true },
5876
5965
  handler: async (args, ctx) => {
@@ -6604,6 +6693,9 @@ var COMPOSITION_TOOLS = [
6604
6693
  studioCompositionSendToSocial
6605
6694
  ];
6606
6695
 
6696
+ // src/promptTools.ts
6697
+ import { z as z11 } from "zod";
6698
+
6607
6699
  // src/manageTools.ts
6608
6700
  import { randomUUID as randomUUID3 } from "crypto";
6609
6701
  import { z as z10 } from "zod";
@@ -6852,10 +6944,87 @@ var MANAGE_TOOLS = [
6852
6944
  studioDeleteCampaign
6853
6945
  ];
6854
6946
 
6947
+ // src/promptTools.ts
6948
+ var MAX_MENTIONS = 10;
6949
+ var mentionSchema = z11.object({
6950
+ kind: z11.enum(["character", "product", "location"]),
6951
+ 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]."),
6952
+ name: z11.string().min(1).max(200).describe("Its display name."),
6953
+ rowId: z11.string().min(1).max(200).optional().describe("Its database id, when known.")
6954
+ }).strict();
6955
+ var settingsSchema = z11.object({
6956
+ model: z11.string().min(1).max(200).optional(),
6957
+ aspectRatio: z11.string().min(1).max(32).optional(),
6958
+ imageSize: z11.string().min(1).max(32).optional(),
6959
+ candidateCount: z11.number().int().min(1).max(8).optional(),
6960
+ thinkingLevel: z11.enum(["none", "minimal", "high"]).optional(),
6961
+ temperature: z11.number().min(0).max(2).optional(),
6962
+ seed: z11.number().int().optional()
6963
+ }).strict();
6964
+ function promptDeleteSummary(p) {
6965
+ const text = p.prompt.trim();
6966
+ const shown = text.length > 120 ? `${text.slice(0, 117)}...` : text;
6967
+ const used = p.usageCount > 0 ? ` It was used ${p.usageCount === 1 ? "once" : `${p.usageCount} times`}.` : "";
6968
+ 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.`;
6969
+ }
6970
+ function promptSubject(p) {
6971
+ return ["delete-prompt", p.id, p.title, p.updatedAt].join(":");
6972
+ }
6973
+ var studioPromptsList = defineTool({
6974
+ name: "studio_prompts_list",
6975
+ 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.',
6976
+ inputSchema: {
6977
+ sort: z11.enum(["newest", "most-used"]).optional().describe("newest (default) or most-used."),
6978
+ limit: z11.number().int().min(1).max(200).optional().describe("How many to return, 1 to 200 (default 50)."),
6979
+ offset: z11.number().int().min(0).optional().describe("Where to start: the nextOffset of the previous page.")
6980
+ },
6981
+ annotations: { readOnlyHint: true },
6982
+ handler: async (args, ctx) => ctx.client.listSavedPrompts(args)
6983
+ });
6984
+ var studioPromptsSave = defineTool({
6985
+ name: "studio_prompts_save",
6986
+ 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.",
6987
+ inputSchema: {
6988
+ prompt: z11.string().min(1).max(2e4).optional().describe("The prompt text, mention tokens such as @[character:bruno] included."),
6989
+ 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.`),
6990
+ settings: settingsSchema.optional().describe("The generation settings to keep with it."),
6991
+ title: z11.string().min(1).max(120).optional().describe("A name for the prompt; defaults to its first words."),
6992
+ assetId: z11.string().min(1).optional().describe("An image, from studio_list_assets: save the prompt it was made with.")
6993
+ },
6994
+ annotations: { idempotentHint: true },
6995
+ handler: async (args, ctx) => {
6996
+ if (!args.prompt && !args.assetId) throw new ToolInputError("Send the prompt text, or an assetId to save the prompt that image was made with.");
6997
+ const res = await ctx.client.savePrompt(args);
6998
+ return { prompt: res.prompt, alreadySaved: res.alreadySaved === true };
6999
+ }
7000
+ });
7001
+ var studioPromptsDelete = defineTool({
7002
+ name: "studio_prompts_delete",
7003
+ 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.",
7004
+ inputSchema: {
7005
+ promptId: z11.string().min(1).describe("The saved prompt, from studio_prompts_list."),
7006
+ confirmationToken
7007
+ },
7008
+ annotations: { destructiveHint: true },
7009
+ handler: async (args, ctx) => {
7010
+ const { prompt } = await ctx.client.getSavedPrompt(args.promptId);
7011
+ const summary = promptDeleteSummary(prompt);
7012
+ const gate = await confirmWithPerson(ctx, summary, promptSubject(prompt), args.confirmationToken);
7013
+ if (gate !== "proceed") return gate;
7014
+ try {
7015
+ const res = await ctx.client.deleteSavedPrompt(args.promptId);
7016
+ return { deleted: true, promptId: res.deleted, summary };
7017
+ } catch (err) {
7018
+ return roleRefusal(err, "Deleting a saved prompt needs a key with at least the company member role; this key does not have it.");
7019
+ }
7020
+ }
7021
+ });
7022
+ var PROMPT_TOOLS = [studioPromptsList, studioPromptsSave, studioPromptsDelete];
7023
+
6855
7024
  // src/tools.ts
6856
- var slug = z11.string().regex(/^[a-z0-9-]+$/, "lowercase letters, numbers and hyphens only").describe("URL-safe identifier: lowercase letters, numbers, hyphens.");
6857
- var waitSeconds = z11.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.");
6858
- var httpUrl = z11.string().url().refine((u) => /^https?:\/\//i.test(u), "must be an http(s) URL");
7025
+ var slug = z12.string().regex(/^[a-z0-9-]+$/, "lowercase letters, numbers and hyphens only").describe("URL-safe identifier: lowercase letters, numbers, hyphens.");
7026
+ 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.");
7027
+ var httpUrl = z12.string().url().refine((u) => /^https?:\/\//i.test(u), "must be an http(s) URL");
6859
7028
  function pollOpts(ctx, timeoutSec) {
6860
7029
  return { ...ctx.poll, timeoutMs: timeoutSec * 1e3 };
6861
7030
  }
@@ -6931,30 +7100,30 @@ var studioGenerateImage = defineTool({
6931
7100
  brandSlug: slug.optional().describe(
6932
7101
  "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."
6933
7102
  ),
6934
- brandMode: z11.string().optional().describe('Optional brand mode (e.g. "illustration"); modes are defined per brand. Only meaningful with brandSlug.'),
6935
- prompt: z11.string().min(1).describe("What to generate. With brandSlug, the brand style prefix is prepended server-side."),
7103
+ brandMode: z12.string().optional().describe('Optional brand mode (e.g. "illustration"); modes are defined per brand. Only meaningful with brandSlug.'),
7104
+ prompt: z12.string().min(1).describe("What to generate. With brandSlug, the brand style prefix is prepended server-side."),
6936
7105
  characterSlug: slug.optional().describe(
6937
7106
  "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."
6938
7107
  ),
6939
- mentions: z11.array(
6940
- z11.object({
6941
- kind: z11.enum(["character", "product", "location"]).describe("What the mention names."),
7108
+ mentions: z12.array(
7109
+ z12.object({
7110
+ kind: z12.enum(["character", "product", "location"]).describe("What the mention names."),
6942
7111
  id: slug.describe("The slug of the character (studio_list_characters), product or location (GET /api/products, GET /api/locations).")
6943
7112
  })
6944
7113
  ).min(1).max(10).optional().describe(
6945
7114
  "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."
6946
7115
  ),
6947
- projectId: z11.string().min(1).optional().describe(
7116
+ projectId: z12.string().min(1).optional().describe(
6948
7117
  '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.'
6949
7118
  ),
6950
- model: z11.string().optional().describe('Image model id (e.g. "kie/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default.'),
6951
- aspectRatio: z11.string().optional().describe('Aspect ratio such as "1:1", "16:9", "3:4".'),
6952
- imageSize: z11.string().optional().describe('Provider size hint, e.g. "1K", "2K".'),
6953
- seed: z11.number().int().optional(),
6954
- candidateCount: z11.number().int().min(1).max(4).optional().describe(
7119
+ model: z12.string().optional().describe('Image model id (e.g. "kie/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default.'),
7120
+ aspectRatio: z12.string().optional().describe('Aspect ratio such as "1:1", "16:9", "3:4".'),
7121
+ imageSize: z12.string().optional().describe('Provider size hint, e.g. "1K", "2K".'),
7122
+ seed: z12.number().int().optional(),
7123
+ candidateCount: z12.number().int().min(1).max(4).optional().describe(
6955
7124
  "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."
6956
7125
  ),
6957
- wait: z11.boolean().default(true).describe("Poll until the job finishes (default true)."),
7126
+ wait: z12.boolean().default(true).describe("Poll until the job finishes (default true)."),
6958
7127
  waitSeconds
6959
7128
  },
6960
7129
  handler: async (args, ctx) => {
@@ -6991,23 +7160,23 @@ var studioGenerate3d = defineTool({
6991
7160
  name: "studio_generate_3d",
6992
7161
  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.",
6993
7162
  inputSchema: {
6994
- prompt: z11.string().min(1).max(1024).describe("What to model. With imageUrl, a short description of the object in the image."),
7163
+ prompt: z12.string().min(1).max(1024).describe("What to model. With imageUrl, a short description of the object in the image."),
6995
7164
  imageUrl: httpUrl.optional().describe("Public http(s) URL of one image to model from. Selects an image model."),
6996
- model: z11.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)."),
6997
- options: z11.object({
6998
- enableTexture: z11.boolean().optional().describe("Texture the mesh (default true). Off gives bare geometry and costs less."),
6999
- enablePbr: z11.boolean().optional().describe("Physically-based rendering (PBR) material maps. Default on for Hunyuan Pro, off elsewhere."),
7000
- textureQuality: z11.enum(["standard", "detailed"]).optional().describe("Tripo texture tier. detailed costs more."),
7001
- geometryQuality: z11.enum(["standard", "detailed"]).optional().describe("Tripo geometry tier. detailed costs more."),
7002
- quadRemesh: z11.boolean().optional().describe("Tripo: quad topology instead of triangles."),
7003
- smartLowPoly: z11.boolean().optional().describe("Tripo text-to-3D: a low-poly mesh."),
7004
- resolution: z11.enum(["512", "1024", "1536"]).optional().describe("TRELLIS.2 resolution (default 1024)."),
7005
- targetPolycount: z11.number().int().min(100).max(15e5).optional().describe("Target face count, where the model supports one."),
7006
- topology: z11.enum(["quad", "triangle"]).optional().describe("Hunyuan Pro polygon type."),
7007
- seed: z11.number().int().optional()
7165
+ 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)."),
7166
+ options: z12.object({
7167
+ enableTexture: z12.boolean().optional().describe("Texture the mesh (default true). Off gives bare geometry and costs less."),
7168
+ enablePbr: z12.boolean().optional().describe("Physically-based rendering (PBR) material maps. Default on for Hunyuan Pro, off elsewhere."),
7169
+ textureQuality: z12.enum(["standard", "detailed"]).optional().describe("Tripo texture tier. detailed costs more."),
7170
+ geometryQuality: z12.enum(["standard", "detailed"]).optional().describe("Tripo geometry tier. detailed costs more."),
7171
+ quadRemesh: z12.boolean().optional().describe("Tripo: quad topology instead of triangles."),
7172
+ smartLowPoly: z12.boolean().optional().describe("Tripo text-to-3D: a low-poly mesh."),
7173
+ resolution: z12.enum(["512", "1024", "1536"]).optional().describe("TRELLIS.2 resolution (default 1024)."),
7174
+ targetPolycount: z12.number().int().min(100).max(15e5).optional().describe("Target face count, where the model supports one."),
7175
+ topology: z12.enum(["quad", "triangle"]).optional().describe("Hunyuan Pro polygon type."),
7176
+ seed: z12.number().int().optional()
7008
7177
  }).optional().describe("Model-specific quality flags. Each changes the price; the returned costUsd is the price of the request that was sent."),
7009
- projectId: z11.string().min(1).optional().describe("Project to file the model under (from studio_list_projects). Omit for the default project."),
7010
- wait: z11.boolean().default(true).describe("Poll until the job finishes (default true)."),
7178
+ projectId: z12.string().min(1).optional().describe("Project to file the model under (from studio_list_projects). Omit for the default project."),
7179
+ wait: z12.boolean().default(true).describe("Poll until the job finishes (default true)."),
7011
7180
  waitSeconds
7012
7181
  },
7013
7182
  handler: async (args, ctx) => {
@@ -7045,8 +7214,8 @@ var studioFindAnimations = defineTool({
7045
7214
  name: "studio_find_animations",
7046
7215
  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.',
7047
7216
  inputSchema: {
7048
- query: z11.string().describe('Words to match, e.g. "sword slash". Empty returns the first presets in library order.'),
7049
- limit: z11.number().int().min(1).max(50).default(25)
7217
+ query: z12.string().describe('Words to match, e.g. "sword slash". Empty returns the first presets in library order.'),
7218
+ limit: z12.number().int().min(1).max(50).default(25)
7050
7219
  },
7051
7220
  annotations: { readOnlyHint: true },
7052
7221
  handler: async (args) => ({ animations: searchAnimations(args.query, args.limit) })
@@ -7055,12 +7224,12 @@ var studioRig3d = defineTool({
7055
7224
  name: "studio_rig_3d",
7056
7225
  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.",
7057
7226
  inputSchema: {
7058
- projectId: z11.string().min(1).describe("The project the mesh lives in (from studio_list_projects)."),
7059
- meshAssetId: z11.string().min(1).describe("The Model3D asset to rig: the assetId studio_generate_3d returned."),
7060
- animations: z11.array(z11.union([z11.string().min(1), z11.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.'),
7061
- heightMeters: z11.number().min(0.3).max(5).optional().describe("The character's approximate height in meters (default 1.7); Meshy scales the rig to it."),
7062
- visibility: z11.enum(["listed", "unlisted"]).optional(),
7063
- wait: z11.boolean().default(true).describe("Poll until the rig finishes (default true)."),
7227
+ projectId: z12.string().min(1).describe("The project the mesh lives in (from studio_list_projects)."),
7228
+ meshAssetId: z12.string().min(1).describe("The Model3D asset to rig: the assetId studio_generate_3d returned."),
7229
+ 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.'),
7230
+ 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."),
7231
+ visibility: z12.enum(["listed", "unlisted"]).optional(),
7232
+ wait: z12.boolean().default(true).describe("Poll until the rig finishes (default true)."),
7064
7233
  waitSeconds
7065
7234
  },
7066
7235
  handler: async (args, ctx) => {
@@ -7117,8 +7286,8 @@ var studioGetJob = defineTool({
7117
7286
  name: "studio_get_job",
7118
7287
  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.",
7119
7288
  inputSchema: {
7120
- jobId: z11.string().min(1),
7121
- wait: z11.boolean().default(false).describe("Poll until terminal (default false: return the current state)."),
7289
+ jobId: z12.string().min(1),
7290
+ wait: z12.boolean().default(false).describe("Poll until terminal (default false: return the current state)."),
7122
7291
  waitSeconds
7123
7292
  },
7124
7293
  annotations: { readOnlyHint: true },
@@ -7151,18 +7320,18 @@ var studioPromptEnhance = defineTool({
7151
7320
  name: "studio_prompt_enhance",
7152
7321
  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.",
7153
7322
  inputSchema: {
7154
- prompt: z11.string().min(1).max(4e3).describe("The prompt to rewrite, mention tokens included."),
7155
- target: z11.enum(["image", "video"]).default("image").describe('What the prompt is for: "image" (default) or "video".'),
7156
- mentions: z11.array(
7157
- z11.object({
7158
- kind: z11.enum(["character", "product", "location"]),
7323
+ prompt: z12.string().min(1).max(4e3).describe("The prompt to rewrite, mention tokens included."),
7324
+ target: z12.enum(["image", "video"]).default("image").describe('What the prompt is for: "image" (default) or "video".'),
7325
+ mentions: z12.array(
7326
+ z12.object({
7327
+ kind: z12.enum(["character", "product", "location"]),
7159
7328
  id: slug.describe("The slug, exactly as the token in the prompt carries it."),
7160
- name: z11.string().max(200).optional()
7329
+ name: z12.string().max(200).optional()
7161
7330
  })
7162
7331
  ).max(10).optional().describe("Every mention token of the prompt (at most 10). The returned mentions carry the names your company gave them."),
7163
- model: z11.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.'),
7332
+ 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.'),
7164
7333
  brandSlug: slug.optional().describe("Optional. A brand of your company whose style the rewrite should follow."),
7165
- brandMode: z11.string().optional().describe('Optional brand mode (e.g. "hero"). Only meaningful with brandSlug.')
7334
+ brandMode: z12.string().optional().describe('Optional brand mode (e.g. "hero"). Only meaningful with brandSlug.')
7166
7335
  },
7167
7336
  annotations: { readOnlyHint: true },
7168
7337
  handler: async (args, ctx) => {
@@ -7177,7 +7346,7 @@ var studioPromptEnhance = defineTool({
7177
7346
  }
7178
7347
  });
7179
7348
  var LIKENESS_REFUSAL = `${LIKENESS_CONFIRMATION_REQUIRED_CODE}: ${likenessConfirmationRequiredMessage()}`;
7180
- var likenessRightsConfirmed = z11.literal(true, { error: LIKENESS_REFUSAL }).describe(likenessConfirmationToolDescription());
7349
+ var likenessRightsConfirmed = z12.literal(true, { error: LIKENESS_REFUSAL }).describe(likenessConfirmationToolDescription());
7181
7350
  function assertLikenessRightsConfirmed(value) {
7182
7351
  if (!isLikenessRightsConfirmed(value)) throw new Error(LIKENESS_REFUSAL);
7183
7352
  }
@@ -7185,11 +7354,11 @@ var studioCreateCharacter = defineTool({
7185
7354
  name: "studio_create_character",
7186
7355
  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.",
7187
7356
  inputSchema: {
7188
- name: z11.string().min(1).describe('Display name, e.g. "Bruno Hartmann".'),
7357
+ name: z12.string().min(1).describe('Display name, e.g. "Bruno Hartmann".'),
7189
7358
  slug,
7190
- descriptorPrompt: z11.string().min(1).describe("The identity description prepended to every generation that uses this character."),
7191
- negativePrompt: z11.string().optional(),
7192
- defaultModel: z11.string().optional().describe("Default image model id for this character."),
7359
+ descriptorPrompt: z12.string().min(1).describe("The identity description prepended to every generation that uses this character."),
7360
+ negativePrompt: z12.string().optional(),
7361
+ defaultModel: z12.string().optional().describe("Default image model id for this character."),
7193
7362
  likenessRightsConfirmed
7194
7363
  },
7195
7364
  handler: async (args, ctx) => {
@@ -7209,16 +7378,16 @@ var studioMintCharacter = defineTool({
7209
7378
  name: "studio_mint_character",
7210
7379
  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.",
7211
7380
  inputSchema: {
7212
- projectId: z11.string().min(1).describe("Project id from studio_list_projects."),
7213
- name: z11.string().min(1).describe("Display name."),
7381
+ projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
7382
+ name: z12.string().min(1).describe("Display name."),
7214
7383
  slug,
7215
- description: z11.string().min(10).describe("Seed identity description (face, hair, age, build, distinguishing features)."),
7216
- descriptorPrompt: z11.string().optional().describe("Override for the character's stored descriptor prompt. Defaults to the description."),
7217
- negativePrompt: z11.string().optional(),
7218
- defaultModel: z11.string().optional(),
7219
- seedModel: z11.string().optional().describe("Override the seed text-to-image model (default fal/nano-banana-2)."),
7220
- viewModel: z11.string().optional().describe("Override the view image-edit model (default fal/nano-banana-2-edit)."),
7221
- visibility: z11.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
7384
+ description: z12.string().min(10).describe("Seed identity description (face, hair, age, build, distinguishing features)."),
7385
+ descriptorPrompt: z12.string().optional().describe("Override for the character's stored descriptor prompt. Defaults to the description."),
7386
+ negativePrompt: z12.string().optional(),
7387
+ defaultModel: z12.string().optional(),
7388
+ seedModel: z12.string().optional().describe("Override the seed text-to-image model (default fal/nano-banana-2)."),
7389
+ viewModel: z12.string().optional().describe("Override the view image-edit model (default fal/nano-banana-2-edit)."),
7390
+ visibility: z12.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
7222
7391
  likenessRightsConfirmed,
7223
7392
  waitSeconds
7224
7393
  },
@@ -7277,12 +7446,12 @@ var studioCreateBrand = defineTool({
7277
7446
  name: "studio_create_brand",
7278
7447
  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.",
7279
7448
  inputSchema: {
7280
- name: z11.string().min(1),
7449
+ name: z12.string().min(1),
7281
7450
  slug,
7282
- stylePrefix: z11.string().optional().describe("Text prepended to every prompt generated under this brand."),
7283
- context: z11.string().optional().describe("Markdown brand context (tone, palette, do/don't)."),
7284
- defaultModel: z11.string().optional(),
7285
- maxReferenceImages: z11.number().int().min(0).max(8).optional()
7451
+ stylePrefix: z12.string().optional().describe("Text prepended to every prompt generated under this brand."),
7452
+ context: z12.string().optional().describe("Markdown brand context (tone, palette, do/don't)."),
7453
+ defaultModel: z12.string().optional(),
7454
+ maxReferenceImages: z12.number().int().min(0).max(8).optional()
7286
7455
  },
7287
7456
  handler: async (args, ctx) => {
7288
7457
  const { config } = await ctx.client.createBrand({
@@ -7301,11 +7470,11 @@ var studioUploadBrandReference = defineTool({
7301
7470
  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.`,
7302
7471
  inputSchema: {
7303
7472
  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."),
7304
- source: z11.string().min(1).describe("Local file path or http(s) URL of an image."),
7305
- category: z11.string().optional().describe('Library category, default "general".'),
7306
- label: z11.string().optional().describe("Optional file name / label."),
7307
- tags: z11.array(z11.string()).optional(),
7308
- score: z11.number().int().min(1).max(10).optional()
7473
+ source: z12.string().min(1).describe("Local file path or http(s) URL of an image."),
7474
+ category: z12.string().optional().describe('Library category, default "general".'),
7475
+ label: z12.string().optional().describe("Optional file name / label."),
7476
+ tags: z12.array(z12.string()).optional(),
7477
+ score: z12.number().int().min(1).max(10).optional()
7309
7478
  },
7310
7479
  handler: async (args, ctx) => {
7311
7480
  const file = await loadImageSource(args.source, ctx.client);
@@ -7326,26 +7495,26 @@ var studioRunWorkflow = defineTool({
7326
7495
  name: "studio_run_workflow",
7327
7496
  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).`,
7328
7497
  inputSchema: {
7329
- projectId: z11.string().min(1).describe("Project id from studio_list_projects."),
7498
+ projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
7330
7499
  definition: workflowDefinitionSchema.optional(),
7331
- savedId: z11.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."),
7332
- params: z11.record(z11.string(), z11.unknown()).optional().describe("Values for the definition's params."),
7333
- nodeIds: z11.array(z11.string()).optional().describe("Run only this subset of nodes (requires an inline `definition` or a `savedId`)."),
7334
- upstreamGenerations: z11.record(z11.string(), z11.string()).optional().describe(
7500
+ 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."),
7501
+ params: z12.record(z12.string(), z12.unknown()).optional().describe("Values for the definition's params."),
7502
+ nodeIds: z12.array(z12.string()).optional().describe("Run only this subset of nodes (requires an inline `definition` or a `savedId`)."),
7503
+ upstreamGenerations: z12.record(z12.string(), z12.string()).optional().describe(
7335
7504
  '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.'
7336
7505
  ),
7337
- runs: z11.number().int().min(1).max(8).optional().describe("Repeat a node subset N times (1 to 8)."),
7338
- visibility: z11.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
7339
- budgetUsd: z11.number().nonnegative().optional().describe(
7506
+ runs: z12.number().int().min(1).max(8).optional().describe("Repeat a node subset N times (1 to 8)."),
7507
+ visibility: z12.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
7508
+ budgetUsd: z12.number().nonnegative().optional().describe(
7340
7509
  '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.'
7341
7510
  ),
7342
- confirm: z11.boolean().optional().describe(
7511
+ confirm: z12.boolean().optional().describe(
7343
7512
  '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 }.'
7344
7513
  ),
7345
- acknowledgeContinuity: z11.boolean().optional().describe(
7514
+ acknowledgeContinuity: z12.boolean().optional().describe(
7346
7515
  '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.'
7347
7516
  ),
7348
- wait: z11.boolean().default(true),
7517
+ wait: z12.boolean().default(true),
7349
7518
  waitSeconds
7350
7519
  },
7351
7520
  handler: async (args, ctx) => {
@@ -7377,8 +7546,8 @@ var studioGetRun = defineTool({
7377
7546
  name: "studio_get_run",
7378
7547
  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.",
7379
7548
  inputSchema: {
7380
- runId: z11.string().min(1),
7381
- wait: z11.boolean().default(false),
7549
+ runId: z12.string().min(1),
7550
+ wait: z12.boolean().default(false),
7382
7551
  waitSeconds
7383
7552
  },
7384
7553
  annotations: { readOnlyHint: true },
@@ -7391,11 +7560,11 @@ var studioDecideJudge = defineTool({
7391
7560
  name: "studio_decide_judge",
7392
7561
  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.",
7393
7562
  inputSchema: {
7394
- runId: z11.string().min(1),
7395
- nodeId: z11.string().min(1),
7396
- verdict: z11.enum(["approved", "rejected"]),
7397
- candidate: z11.object({ generationId: z11.string().min(1), index: z11.number().int().min(0).optional() }).optional(),
7398
- reason: z11.string().max(500).optional()
7563
+ runId: z12.string().min(1),
7564
+ nodeId: z12.string().min(1),
7565
+ verdict: z12.enum(["approved", "rejected"]),
7566
+ candidate: z12.object({ generationId: z12.string().min(1), index: z12.number().int().min(0).optional() }).optional(),
7567
+ reason: z12.string().max(500).optional()
7399
7568
  },
7400
7569
  annotations: { destructiveHint: false, idempotentHint: false },
7401
7570
  handler: async (args, ctx) => {
@@ -7411,8 +7580,8 @@ var studioGetRunOutput = defineTool({
7411
7580
  name: "studio_get_run_output",
7412
7581
  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.",
7413
7582
  inputSchema: {
7414
- runId: z11.string().min(1),
7415
- nodeId: z11.string().min(1)
7583
+ runId: z12.string().min(1),
7584
+ nodeId: z12.string().min(1)
7416
7585
  },
7417
7586
  annotations: { readOnlyHint: true },
7418
7587
  handler: async (args, ctx) => {
@@ -7424,22 +7593,22 @@ var studioReplaceCharacterInVideo = defineTool({
7424
7593
  name: "studio_replace_character_in_video",
7425
7594
  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.',
7426
7595
  inputSchema: {
7427
- projectId: z11.string().min(1).describe("Project id from studio_list_projects."),
7596
+ projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
7428
7597
  sceneFrameUrl: httpUrl.describe("Public or signed URL of ONE frame of the target shot (png/jpg)."),
7429
7598
  characterSlug: slug.optional().describe(
7430
7599
  "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."
7431
7600
  ),
7432
7601
  characterReferenceUrl: httpUrl.optional().describe("Explicit character reference image URL (use instead of characterSlug)."),
7433
7602
  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."),
7434
- scope: z11.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."),
7435
- preserve: z11.array(z11.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.'),
7436
- swapPrompt: z11.string().optional().describe("A complete still-swap edit prompt of your own; replaces the composed one, so scope and preserve are then ignored."),
7437
- motionPrompt: z11.string().optional().describe("Override the motion description for the video node."),
7438
- videoModel: z11.string().optional().describe(`Image-to-video model id. Default ${DEFAULT_SWAP_VIDEO_MODEL}, or ${KEYFRAME_SWAP_VIDEO_MODEL} when endFrameUrl is given.`),
7439
- editModel: z11.string().default(DEFAULT_SWAP_EDIT_MODEL).describe("Image-edit model id for the still swap."),
7440
- aspectRatio: z11.string().default("16:9"),
7441
- visibility: z11.enum(["listed", "unlisted"]).optional(),
7442
- acknowledgeContinuity: z11.boolean().optional().describe(
7603
+ 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."),
7604
+ 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.'),
7605
+ 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."),
7606
+ motionPrompt: z12.string().optional().describe("Override the motion description for the video node."),
7607
+ videoModel: z12.string().optional().describe(`Image-to-video model id. Default ${DEFAULT_SWAP_VIDEO_MODEL}, or ${KEYFRAME_SWAP_VIDEO_MODEL} when endFrameUrl is given.`),
7608
+ editModel: z12.string().default(DEFAULT_SWAP_EDIT_MODEL).describe("Image-edit model id for the still swap."),
7609
+ aspectRatio: z12.string().default("16:9"),
7610
+ visibility: z12.enum(["listed", "unlisted"]).optional(),
7611
+ acknowledgeContinuity: z12.boolean().optional().describe(
7443
7612
  "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."
7444
7613
  ),
7445
7614
  waitSeconds
@@ -7507,7 +7676,7 @@ var studioGetSpend = defineTool({
7507
7676
  name: "studio_get_spend",
7508
7677
  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).`,
7509
7678
  inputSchema: {
7510
- tzOffsetMinutes: z11.number().int().min(-840).max(840).optional()
7679
+ tzOffsetMinutes: z12.number().int().min(-840).max(840).optional()
7511
7680
  },
7512
7681
  annotations: { readOnlyHint: true },
7513
7682
  handler: async (args, ctx) => {
@@ -7535,7 +7704,7 @@ var studioDescribePublished = defineTool({
7535
7704
  name: "studio_describe_published",
7536
7705
  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.",
7537
7706
  inputSchema: {
7538
- slug: z11.string().min(1).describe("The recipe slug, from studio_list_published.")
7707
+ slug: z12.string().min(1).describe("The recipe slug, from studio_list_published.")
7539
7708
  },
7540
7709
  annotations: { readOnlyHint: true },
7541
7710
  handler: async (args, ctx) => {
@@ -7547,20 +7716,20 @@ var studioRunPublished = defineTool({
7547
7716
  name: "studio_run_published",
7548
7717
  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).`,
7549
7718
  inputSchema: {
7550
- slug: z11.string().min(1).describe("The recipe slug, from studio_list_published."),
7551
- projectId: z11.string().min(1).describe("Project id from studio_list_projects."),
7552
- params: z11.record(z11.string(), z11.unknown()).optional().describe("Values for the recipe's params (see studio_describe_published)."),
7553
- budgetUsd: z11.number().nonnegative().optional().describe(
7719
+ slug: z12.string().min(1).describe("The recipe slug, from studio_list_published."),
7720
+ projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
7721
+ params: z12.record(z12.string(), z12.unknown()).optional().describe("Values for the recipe's params (see studio_describe_published)."),
7722
+ budgetUsd: z12.number().nonnegative().optional().describe(
7554
7723
  '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 }.'
7555
7724
  ),
7556
- confirm: z11.boolean().optional().describe(
7725
+ confirm: z12.boolean().optional().describe(
7557
7726
  '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 }.'
7558
7727
  ),
7559
- likenessRightsConfirmed: z11.literal(true).optional().describe(`Required when the recipe creates a character; ignored otherwise. ${likenessConfirmationToolDescription()}`),
7560
- acknowledgeContinuity: z11.boolean().optional().describe(
7728
+ likenessRightsConfirmed: z12.literal(true).optional().describe(`Required when the recipe creates a character; ignored otherwise. ${likenessConfirmationToolDescription()}`),
7729
+ acknowledgeContinuity: z12.boolean().optional().describe(
7561
7730
  '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.'
7562
7731
  ),
7563
- wait: z11.boolean().default(true),
7732
+ wait: z12.boolean().default(true),
7564
7733
  waitSeconds
7565
7734
  },
7566
7735
  handler: async (args, ctx) => {
@@ -7603,7 +7772,8 @@ var TOOLS = [
7603
7772
  studioGetUsage,
7604
7773
  ...WORKFLOW_TOOLS,
7605
7774
  ...MANAGE_TOOLS,
7606
- ...COMPOSITION_TOOLS
7775
+ ...COMPOSITION_TOOLS,
7776
+ ...PROMPT_TOOLS
7607
7777
  ];
7608
7778
  var TOOL_NAMES = TOOLS.map((t) => t.name);
7609
7779
  function toolResult(value) {
@@ -7621,7 +7791,7 @@ function toolError(message) {
7621
7791
  }
7622
7792
  async function invokeTool(def, args, ctx) {
7623
7793
  try {
7624
- const parsed = z11.object(def.inputSchema).parse(args ?? {});
7794
+ const parsed = z12.object(def.inputSchema).parse(args ?? {});
7625
7795
  const value = await def.handler(parsed, ctx);
7626
7796
  return toolResult(value);
7627
7797
  } catch (err) {
@@ -7672,7 +7842,7 @@ function registerTools(server, base) {
7672
7842
 
7673
7843
  // src/server.ts
7674
7844
  var SERVER_NAME = "lumitra-studio";
7675
- var SERVER_VERSION = "0.14.0";
7845
+ var SERVER_VERSION = "0.16.0";
7676
7846
  function createStudioMcpServer(opts = {}) {
7677
7847
  const config = opts.config ?? resolveConfig(opts.env ?? process.env);
7678
7848
  const client = new StudioClient(config, {