@marlinjai/studio-mcp 0.13.0 → 0.15.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
@@ -228,6 +247,15 @@ var StudioClient = class {
228
247
  getCharacter(slug2) {
229
248
  return this.json("GET", `/api/characters/${encodeURIComponent(slug2)}`);
230
249
  }
250
+ // ── Prompts ──
251
+ /**
252
+ * Enhance: the prompt rewritten into a richer one for an image or video
253
+ * model, every mention token (`@[character:<slug>]`) kept exactly once.
254
+ * Free for the company, limited per key (429 with the wait in `error`).
255
+ */
256
+ enhancePrompt(body) {
257
+ return this.json("POST", "/api/v1/prompts/enhance", { json: body });
258
+ }
231
259
  createCharacter(body) {
232
260
  return this.json("POST", "/api/characters", { json: body });
233
261
  }
@@ -524,7 +552,7 @@ function projectQuery(projectId) {
524
552
  }
525
553
 
526
554
  // src/tools.ts
527
- import { z as z11 } from "zod";
555
+ import { z as z12 } from "zod";
528
556
 
529
557
  // ../lumitra-core/dist/models/index.js
530
558
  var veo = (tier, label) => {
@@ -6595,6 +6623,9 @@ var COMPOSITION_TOOLS = [
6595
6623
  studioCompositionSendToSocial
6596
6624
  ];
6597
6625
 
6626
+ // src/promptTools.ts
6627
+ import { z as z11 } from "zod";
6628
+
6598
6629
  // src/manageTools.ts
6599
6630
  import { randomUUID as randomUUID3 } from "crypto";
6600
6631
  import { z as z10 } from "zod";
@@ -6843,10 +6874,87 @@ var MANAGE_TOOLS = [
6843
6874
  studioDeleteCampaign
6844
6875
  ];
6845
6876
 
6877
+ // src/promptTools.ts
6878
+ var MAX_MENTIONS = 10;
6879
+ var mentionSchema = z11.object({
6880
+ kind: z11.enum(["character", "product", "location"]),
6881
+ 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]."),
6882
+ name: z11.string().min(1).max(200).describe("Its display name."),
6883
+ rowId: z11.string().min(1).max(200).optional().describe("Its database id, when known.")
6884
+ }).strict();
6885
+ var settingsSchema = z11.object({
6886
+ model: z11.string().min(1).max(200).optional(),
6887
+ aspectRatio: z11.string().min(1).max(32).optional(),
6888
+ imageSize: z11.string().min(1).max(32).optional(),
6889
+ candidateCount: z11.number().int().min(1).max(8).optional(),
6890
+ thinkingLevel: z11.enum(["none", "minimal", "high"]).optional(),
6891
+ temperature: z11.number().min(0).max(2).optional(),
6892
+ seed: z11.number().int().optional()
6893
+ }).strict();
6894
+ function promptDeleteSummary(p) {
6895
+ const text = p.prompt.trim();
6896
+ const shown = text.length > 120 ? `${text.slice(0, 117)}...` : text;
6897
+ const used = p.usageCount > 0 ? ` It was used ${p.usageCount === 1 ? "once" : `${p.usageCount} times`}.` : "";
6898
+ 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.`;
6899
+ }
6900
+ function promptSubject(p) {
6901
+ return ["delete-prompt", p.id, p.title, p.updatedAt].join(":");
6902
+ }
6903
+ var studioPromptsList = defineTool({
6904
+ name: "studio_prompts_list",
6905
+ 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.',
6906
+ inputSchema: {
6907
+ sort: z11.enum(["newest", "most-used"]).optional().describe("newest (default) or most-used."),
6908
+ limit: z11.number().int().min(1).max(200).optional().describe("How many to return, 1 to 200 (default 50)."),
6909
+ offset: z11.number().int().min(0).optional().describe("Where to start: the nextOffset of the previous page.")
6910
+ },
6911
+ annotations: { readOnlyHint: true },
6912
+ handler: async (args, ctx) => ctx.client.listSavedPrompts(args)
6913
+ });
6914
+ var studioPromptsSave = defineTool({
6915
+ name: "studio_prompts_save",
6916
+ 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.",
6917
+ inputSchema: {
6918
+ prompt: z11.string().min(1).max(2e4).optional().describe("The prompt text, mention tokens such as @[character:bruno] included."),
6919
+ 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.`),
6920
+ settings: settingsSchema.optional().describe("The generation settings to keep with it."),
6921
+ title: z11.string().min(1).max(120).optional().describe("A name for the prompt; defaults to its first words."),
6922
+ assetId: z11.string().min(1).optional().describe("An image, from studio_list_assets: save the prompt it was made with.")
6923
+ },
6924
+ annotations: { idempotentHint: true },
6925
+ handler: async (args, ctx) => {
6926
+ if (!args.prompt && !args.assetId) throw new ToolInputError("Send the prompt text, or an assetId to save the prompt that image was made with.");
6927
+ const res = await ctx.client.savePrompt(args);
6928
+ return { prompt: res.prompt, alreadySaved: res.alreadySaved === true };
6929
+ }
6930
+ });
6931
+ var studioPromptsDelete = defineTool({
6932
+ name: "studio_prompts_delete",
6933
+ 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.",
6934
+ inputSchema: {
6935
+ promptId: z11.string().min(1).describe("The saved prompt, from studio_prompts_list."),
6936
+ confirmationToken
6937
+ },
6938
+ annotations: { destructiveHint: true },
6939
+ handler: async (args, ctx) => {
6940
+ const { prompt } = await ctx.client.getSavedPrompt(args.promptId);
6941
+ const summary = promptDeleteSummary(prompt);
6942
+ const gate = await confirmWithPerson(ctx, summary, promptSubject(prompt), args.confirmationToken);
6943
+ if (gate !== "proceed") return gate;
6944
+ try {
6945
+ const res = await ctx.client.deleteSavedPrompt(args.promptId);
6946
+ return { deleted: true, promptId: res.deleted, summary };
6947
+ } catch (err) {
6948
+ return roleRefusal(err, "Deleting a saved prompt needs a key with at least the company member role; this key does not have it.");
6949
+ }
6950
+ }
6951
+ });
6952
+ var PROMPT_TOOLS = [studioPromptsList, studioPromptsSave, studioPromptsDelete];
6953
+
6846
6954
  // src/tools.ts
6847
- var slug = z11.string().regex(/^[a-z0-9-]+$/, "lowercase letters, numbers and hyphens only").describe("URL-safe identifier: lowercase letters, numbers, hyphens.");
6848
- 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.");
6849
- var httpUrl = z11.string().url().refine((u) => /^https?:\/\//i.test(u), "must be an http(s) URL");
6955
+ var slug = z12.string().regex(/^[a-z0-9-]+$/, "lowercase letters, numbers and hyphens only").describe("URL-safe identifier: lowercase letters, numbers, hyphens.");
6956
+ 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.");
6957
+ var httpUrl = z12.string().url().refine((u) => /^https?:\/\//i.test(u), "must be an http(s) URL");
6850
6958
  function pollOpts(ctx, timeoutSec) {
6851
6959
  return { ...ctx.poll, timeoutMs: timeoutSec * 1e3 };
6852
6960
  }
@@ -6922,30 +7030,30 @@ var studioGenerateImage = defineTool({
6922
7030
  brandSlug: slug.optional().describe(
6923
7031
  "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."
6924
7032
  ),
6925
- brandMode: z11.string().optional().describe('Optional brand mode (e.g. "illustration"); modes are defined per brand. Only meaningful with brandSlug.'),
6926
- prompt: z11.string().min(1).describe("What to generate. With brandSlug, the brand style prefix is prepended server-side."),
7033
+ brandMode: z12.string().optional().describe('Optional brand mode (e.g. "illustration"); modes are defined per brand. Only meaningful with brandSlug.'),
7034
+ prompt: z12.string().min(1).describe("What to generate. With brandSlug, the brand style prefix is prepended server-side."),
6927
7035
  characterSlug: slug.optional().describe(
6928
7036
  "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."
6929
7037
  ),
6930
- mentions: z11.array(
6931
- z11.object({
6932
- kind: z11.enum(["character", "product", "location"]).describe("What the mention names."),
7038
+ mentions: z12.array(
7039
+ z12.object({
7040
+ kind: z12.enum(["character", "product", "location"]).describe("What the mention names."),
6933
7041
  id: slug.describe("The slug of the character (studio_list_characters), product or location (GET /api/products, GET /api/locations).")
6934
7042
  })
6935
7043
  ).min(1).max(10).optional().describe(
6936
7044
  "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."
6937
7045
  ),
6938
- projectId: z11.string().min(1).optional().describe(
7046
+ projectId: z12.string().min(1).optional().describe(
6939
7047
  '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.'
6940
7048
  ),
6941
- model: z11.string().optional().describe('Image model id (e.g. "kie/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default.'),
6942
- aspectRatio: z11.string().optional().describe('Aspect ratio such as "1:1", "16:9", "3:4".'),
6943
- imageSize: z11.string().optional().describe('Provider size hint, e.g. "1K", "2K".'),
6944
- seed: z11.number().int().optional(),
6945
- candidateCount: z11.number().int().min(1).max(4).optional().describe(
7049
+ model: z12.string().optional().describe('Image model id (e.g. "kie/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default.'),
7050
+ aspectRatio: z12.string().optional().describe('Aspect ratio such as "1:1", "16:9", "3:4".'),
7051
+ imageSize: z12.string().optional().describe('Provider size hint, e.g. "1K", "2K".'),
7052
+ seed: z12.number().int().optional(),
7053
+ candidateCount: z12.number().int().min(1).max(4).optional().describe(
6946
7054
  "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."
6947
7055
  ),
6948
- wait: z11.boolean().default(true).describe("Poll until the job finishes (default true)."),
7056
+ wait: z12.boolean().default(true).describe("Poll until the job finishes (default true)."),
6949
7057
  waitSeconds
6950
7058
  },
6951
7059
  handler: async (args, ctx) => {
@@ -6982,23 +7090,23 @@ var studioGenerate3d = defineTool({
6982
7090
  name: "studio_generate_3d",
6983
7091
  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.",
6984
7092
  inputSchema: {
6985
- prompt: z11.string().min(1).max(1024).describe("What to model. With imageUrl, a short description of the object in the image."),
7093
+ prompt: z12.string().min(1).max(1024).describe("What to model. With imageUrl, a short description of the object in the image."),
6986
7094
  imageUrl: httpUrl.optional().describe("Public http(s) URL of one image to model from. Selects an image model."),
6987
- 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)."),
6988
- options: z11.object({
6989
- enableTexture: z11.boolean().optional().describe("Texture the mesh (default true). Off gives bare geometry and costs less."),
6990
- enablePbr: z11.boolean().optional().describe("Physically-based rendering (PBR) material maps. Default on for Hunyuan Pro, off elsewhere."),
6991
- textureQuality: z11.enum(["standard", "detailed"]).optional().describe("Tripo texture tier. detailed costs more."),
6992
- geometryQuality: z11.enum(["standard", "detailed"]).optional().describe("Tripo geometry tier. detailed costs more."),
6993
- quadRemesh: z11.boolean().optional().describe("Tripo: quad topology instead of triangles."),
6994
- smartLowPoly: z11.boolean().optional().describe("Tripo text-to-3D: a low-poly mesh."),
6995
- resolution: z11.enum(["512", "1024", "1536"]).optional().describe("TRELLIS.2 resolution (default 1024)."),
6996
- targetPolycount: z11.number().int().min(100).max(15e5).optional().describe("Target face count, where the model supports one."),
6997
- topology: z11.enum(["quad", "triangle"]).optional().describe("Hunyuan Pro polygon type."),
6998
- seed: z11.number().int().optional()
7095
+ 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)."),
7096
+ options: z12.object({
7097
+ enableTexture: z12.boolean().optional().describe("Texture the mesh (default true). Off gives bare geometry and costs less."),
7098
+ enablePbr: z12.boolean().optional().describe("Physically-based rendering (PBR) material maps. Default on for Hunyuan Pro, off elsewhere."),
7099
+ textureQuality: z12.enum(["standard", "detailed"]).optional().describe("Tripo texture tier. detailed costs more."),
7100
+ geometryQuality: z12.enum(["standard", "detailed"]).optional().describe("Tripo geometry tier. detailed costs more."),
7101
+ quadRemesh: z12.boolean().optional().describe("Tripo: quad topology instead of triangles."),
7102
+ smartLowPoly: z12.boolean().optional().describe("Tripo text-to-3D: a low-poly mesh."),
7103
+ resolution: z12.enum(["512", "1024", "1536"]).optional().describe("TRELLIS.2 resolution (default 1024)."),
7104
+ targetPolycount: z12.number().int().min(100).max(15e5).optional().describe("Target face count, where the model supports one."),
7105
+ topology: z12.enum(["quad", "triangle"]).optional().describe("Hunyuan Pro polygon type."),
7106
+ seed: z12.number().int().optional()
6999
7107
  }).optional().describe("Model-specific quality flags. Each changes the price; the returned costUsd is the price of the request that was sent."),
7000
- projectId: z11.string().min(1).optional().describe("Project to file the model under (from studio_list_projects). Omit for the default project."),
7001
- wait: z11.boolean().default(true).describe("Poll until the job finishes (default true)."),
7108
+ projectId: z12.string().min(1).optional().describe("Project to file the model under (from studio_list_projects). Omit for the default project."),
7109
+ wait: z12.boolean().default(true).describe("Poll until the job finishes (default true)."),
7002
7110
  waitSeconds
7003
7111
  },
7004
7112
  handler: async (args, ctx) => {
@@ -7036,8 +7144,8 @@ var studioFindAnimations = defineTool({
7036
7144
  name: "studio_find_animations",
7037
7145
  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.',
7038
7146
  inputSchema: {
7039
- query: z11.string().describe('Words to match, e.g. "sword slash". Empty returns the first presets in library order.'),
7040
- limit: z11.number().int().min(1).max(50).default(25)
7147
+ query: z12.string().describe('Words to match, e.g. "sword slash". Empty returns the first presets in library order.'),
7148
+ limit: z12.number().int().min(1).max(50).default(25)
7041
7149
  },
7042
7150
  annotations: { readOnlyHint: true },
7043
7151
  handler: async (args) => ({ animations: searchAnimations(args.query, args.limit) })
@@ -7046,12 +7154,12 @@ var studioRig3d = defineTool({
7046
7154
  name: "studio_rig_3d",
7047
7155
  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.",
7048
7156
  inputSchema: {
7049
- projectId: z11.string().min(1).describe("The project the mesh lives in (from studio_list_projects)."),
7050
- meshAssetId: z11.string().min(1).describe("The Model3D asset to rig: the assetId studio_generate_3d returned."),
7051
- 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.'),
7052
- 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."),
7053
- visibility: z11.enum(["listed", "unlisted"]).optional(),
7054
- wait: z11.boolean().default(true).describe("Poll until the rig finishes (default true)."),
7157
+ projectId: z12.string().min(1).describe("The project the mesh lives in (from studio_list_projects)."),
7158
+ meshAssetId: z12.string().min(1).describe("The Model3D asset to rig: the assetId studio_generate_3d returned."),
7159
+ 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.'),
7160
+ 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."),
7161
+ visibility: z12.enum(["listed", "unlisted"]).optional(),
7162
+ wait: z12.boolean().default(true).describe("Poll until the rig finishes (default true)."),
7055
7163
  waitSeconds
7056
7164
  },
7057
7165
  handler: async (args, ctx) => {
@@ -7108,8 +7216,8 @@ var studioGetJob = defineTool({
7108
7216
  name: "studio_get_job",
7109
7217
  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.",
7110
7218
  inputSchema: {
7111
- jobId: z11.string().min(1),
7112
- wait: z11.boolean().default(false).describe("Poll until terminal (default false: return the current state)."),
7219
+ jobId: z12.string().min(1),
7220
+ wait: z12.boolean().default(false).describe("Poll until terminal (default false: return the current state)."),
7113
7221
  waitSeconds
7114
7222
  },
7115
7223
  annotations: { readOnlyHint: true },
@@ -7138,8 +7246,37 @@ var studioGetCharacter = defineTool({
7138
7246
  return { character };
7139
7247
  }
7140
7248
  });
7249
+ var studioPromptEnhance = defineTool({
7250
+ name: "studio_prompt_enhance",
7251
+ 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.",
7252
+ inputSchema: {
7253
+ prompt: z12.string().min(1).max(4e3).describe("The prompt to rewrite, mention tokens included."),
7254
+ target: z12.enum(["image", "video"]).default("image").describe('What the prompt is for: "image" (default) or "video".'),
7255
+ mentions: z12.array(
7256
+ z12.object({
7257
+ kind: z12.enum(["character", "product", "location"]),
7258
+ id: slug.describe("The slug, exactly as the token in the prompt carries it."),
7259
+ name: z12.string().max(200).optional()
7260
+ })
7261
+ ).max(10).optional().describe("Every mention token of the prompt (at most 10). The returned mentions carry the names your company gave them."),
7262
+ 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.'),
7263
+ brandSlug: slug.optional().describe("Optional. A brand of your company whose style the rewrite should follow."),
7264
+ brandMode: z12.string().optional().describe('Optional brand mode (e.g. "hero"). Only meaningful with brandSlug.')
7265
+ },
7266
+ annotations: { readOnlyHint: true },
7267
+ handler: async (args, ctx) => {
7268
+ return ctx.client.enhancePrompt({
7269
+ prompt: args.prompt,
7270
+ target: args.target,
7271
+ ...args.mentions && args.mentions.length > 0 ? { mentions: args.mentions } : {},
7272
+ ...args.model ? { model: args.model } : {},
7273
+ ...args.brandSlug ? { brandSlug: args.brandSlug } : {},
7274
+ ...args.brandMode ? { brandMode: args.brandMode } : {}
7275
+ });
7276
+ }
7277
+ });
7141
7278
  var LIKENESS_REFUSAL = `${LIKENESS_CONFIRMATION_REQUIRED_CODE}: ${likenessConfirmationRequiredMessage()}`;
7142
- var likenessRightsConfirmed = z11.literal(true, { error: LIKENESS_REFUSAL }).describe(likenessConfirmationToolDescription());
7279
+ var likenessRightsConfirmed = z12.literal(true, { error: LIKENESS_REFUSAL }).describe(likenessConfirmationToolDescription());
7143
7280
  function assertLikenessRightsConfirmed(value) {
7144
7281
  if (!isLikenessRightsConfirmed(value)) throw new Error(LIKENESS_REFUSAL);
7145
7282
  }
@@ -7147,11 +7284,11 @@ var studioCreateCharacter = defineTool({
7147
7284
  name: "studio_create_character",
7148
7285
  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.",
7149
7286
  inputSchema: {
7150
- name: z11.string().min(1).describe('Display name, e.g. "Bruno Hartmann".'),
7287
+ name: z12.string().min(1).describe('Display name, e.g. "Bruno Hartmann".'),
7151
7288
  slug,
7152
- descriptorPrompt: z11.string().min(1).describe("The identity description prepended to every generation that uses this character."),
7153
- negativePrompt: z11.string().optional(),
7154
- defaultModel: z11.string().optional().describe("Default image model id for this character."),
7289
+ descriptorPrompt: z12.string().min(1).describe("The identity description prepended to every generation that uses this character."),
7290
+ negativePrompt: z12.string().optional(),
7291
+ defaultModel: z12.string().optional().describe("Default image model id for this character."),
7155
7292
  likenessRightsConfirmed
7156
7293
  },
7157
7294
  handler: async (args, ctx) => {
@@ -7171,16 +7308,16 @@ var studioMintCharacter = defineTool({
7171
7308
  name: "studio_mint_character",
7172
7309
  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.",
7173
7310
  inputSchema: {
7174
- projectId: z11.string().min(1).describe("Project id from studio_list_projects."),
7175
- name: z11.string().min(1).describe("Display name."),
7311
+ projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
7312
+ name: z12.string().min(1).describe("Display name."),
7176
7313
  slug,
7177
- description: z11.string().min(10).describe("Seed identity description (face, hair, age, build, distinguishing features)."),
7178
- descriptorPrompt: z11.string().optional().describe("Override for the character's stored descriptor prompt. Defaults to the description."),
7179
- negativePrompt: z11.string().optional(),
7180
- defaultModel: z11.string().optional(),
7181
- seedModel: z11.string().optional().describe("Override the seed text-to-image model (default fal/nano-banana-2)."),
7182
- viewModel: z11.string().optional().describe("Override the view image-edit model (default fal/nano-banana-2-edit)."),
7183
- visibility: z11.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
7314
+ description: z12.string().min(10).describe("Seed identity description (face, hair, age, build, distinguishing features)."),
7315
+ descriptorPrompt: z12.string().optional().describe("Override for the character's stored descriptor prompt. Defaults to the description."),
7316
+ negativePrompt: z12.string().optional(),
7317
+ defaultModel: z12.string().optional(),
7318
+ seedModel: z12.string().optional().describe("Override the seed text-to-image model (default fal/nano-banana-2)."),
7319
+ viewModel: z12.string().optional().describe("Override the view image-edit model (default fal/nano-banana-2-edit)."),
7320
+ visibility: z12.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
7184
7321
  likenessRightsConfirmed,
7185
7322
  waitSeconds
7186
7323
  },
@@ -7239,12 +7376,12 @@ var studioCreateBrand = defineTool({
7239
7376
  name: "studio_create_brand",
7240
7377
  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.",
7241
7378
  inputSchema: {
7242
- name: z11.string().min(1),
7379
+ name: z12.string().min(1),
7243
7380
  slug,
7244
- stylePrefix: z11.string().optional().describe("Text prepended to every prompt generated under this brand."),
7245
- context: z11.string().optional().describe("Markdown brand context (tone, palette, do/don't)."),
7246
- defaultModel: z11.string().optional(),
7247
- maxReferenceImages: z11.number().int().min(0).max(8).optional()
7381
+ stylePrefix: z12.string().optional().describe("Text prepended to every prompt generated under this brand."),
7382
+ context: z12.string().optional().describe("Markdown brand context (tone, palette, do/don't)."),
7383
+ defaultModel: z12.string().optional(),
7384
+ maxReferenceImages: z12.number().int().min(0).max(8).optional()
7248
7385
  },
7249
7386
  handler: async (args, ctx) => {
7250
7387
  const { config } = await ctx.client.createBrand({
@@ -7263,11 +7400,11 @@ var studioUploadBrandReference = defineTool({
7263
7400
  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.`,
7264
7401
  inputSchema: {
7265
7402
  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."),
7266
- source: z11.string().min(1).describe("Local file path or http(s) URL of an image."),
7267
- category: z11.string().optional().describe('Library category, default "general".'),
7268
- label: z11.string().optional().describe("Optional file name / label."),
7269
- tags: z11.array(z11.string()).optional(),
7270
- score: z11.number().int().min(1).max(10).optional()
7403
+ source: z12.string().min(1).describe("Local file path or http(s) URL of an image."),
7404
+ category: z12.string().optional().describe('Library category, default "general".'),
7405
+ label: z12.string().optional().describe("Optional file name / label."),
7406
+ tags: z12.array(z12.string()).optional(),
7407
+ score: z12.number().int().min(1).max(10).optional()
7271
7408
  },
7272
7409
  handler: async (args, ctx) => {
7273
7410
  const file = await loadImageSource(args.source, ctx.client);
@@ -7288,26 +7425,26 @@ var studioRunWorkflow = defineTool({
7288
7425
  name: "studio_run_workflow",
7289
7426
  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).`,
7290
7427
  inputSchema: {
7291
- projectId: z11.string().min(1).describe("Project id from studio_list_projects."),
7428
+ projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
7292
7429
  definition: workflowDefinitionSchema.optional(),
7293
- 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."),
7294
- params: z11.record(z11.string(), z11.unknown()).optional().describe("Values for the definition's params."),
7295
- nodeIds: z11.array(z11.string()).optional().describe("Run only this subset of nodes (requires an inline `definition` or a `savedId`)."),
7296
- upstreamGenerations: z11.record(z11.string(), z11.string()).optional().describe(
7430
+ 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."),
7431
+ params: z12.record(z12.string(), z12.unknown()).optional().describe("Values for the definition's params."),
7432
+ nodeIds: z12.array(z12.string()).optional().describe("Run only this subset of nodes (requires an inline `definition` or a `savedId`)."),
7433
+ upstreamGenerations: z12.record(z12.string(), z12.string()).optional().describe(
7297
7434
  '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.'
7298
7435
  ),
7299
- runs: z11.number().int().min(1).max(8).optional().describe("Repeat a node subset N times (1 to 8)."),
7300
- visibility: z11.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
7301
- budgetUsd: z11.number().nonnegative().optional().describe(
7436
+ runs: z12.number().int().min(1).max(8).optional().describe("Repeat a node subset N times (1 to 8)."),
7437
+ visibility: z12.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
7438
+ budgetUsd: z12.number().nonnegative().optional().describe(
7302
7439
  '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.'
7303
7440
  ),
7304
- confirm: z11.boolean().optional().describe(
7441
+ confirm: z12.boolean().optional().describe(
7305
7442
  '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 }.'
7306
7443
  ),
7307
- acknowledgeContinuity: z11.boolean().optional().describe(
7444
+ acknowledgeContinuity: z12.boolean().optional().describe(
7308
7445
  '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.'
7309
7446
  ),
7310
- wait: z11.boolean().default(true),
7447
+ wait: z12.boolean().default(true),
7311
7448
  waitSeconds
7312
7449
  },
7313
7450
  handler: async (args, ctx) => {
@@ -7339,8 +7476,8 @@ var studioGetRun = defineTool({
7339
7476
  name: "studio_get_run",
7340
7477
  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.",
7341
7478
  inputSchema: {
7342
- runId: z11.string().min(1),
7343
- wait: z11.boolean().default(false),
7479
+ runId: z12.string().min(1),
7480
+ wait: z12.boolean().default(false),
7344
7481
  waitSeconds
7345
7482
  },
7346
7483
  annotations: { readOnlyHint: true },
@@ -7353,11 +7490,11 @@ var studioDecideJudge = defineTool({
7353
7490
  name: "studio_decide_judge",
7354
7491
  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.",
7355
7492
  inputSchema: {
7356
- runId: z11.string().min(1),
7357
- nodeId: z11.string().min(1),
7358
- verdict: z11.enum(["approved", "rejected"]),
7359
- candidate: z11.object({ generationId: z11.string().min(1), index: z11.number().int().min(0).optional() }).optional(),
7360
- reason: z11.string().max(500).optional()
7493
+ runId: z12.string().min(1),
7494
+ nodeId: z12.string().min(1),
7495
+ verdict: z12.enum(["approved", "rejected"]),
7496
+ candidate: z12.object({ generationId: z12.string().min(1), index: z12.number().int().min(0).optional() }).optional(),
7497
+ reason: z12.string().max(500).optional()
7361
7498
  },
7362
7499
  annotations: { destructiveHint: false, idempotentHint: false },
7363
7500
  handler: async (args, ctx) => {
@@ -7373,8 +7510,8 @@ var studioGetRunOutput = defineTool({
7373
7510
  name: "studio_get_run_output",
7374
7511
  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.",
7375
7512
  inputSchema: {
7376
- runId: z11.string().min(1),
7377
- nodeId: z11.string().min(1)
7513
+ runId: z12.string().min(1),
7514
+ nodeId: z12.string().min(1)
7378
7515
  },
7379
7516
  annotations: { readOnlyHint: true },
7380
7517
  handler: async (args, ctx) => {
@@ -7386,22 +7523,22 @@ var studioReplaceCharacterInVideo = defineTool({
7386
7523
  name: "studio_replace_character_in_video",
7387
7524
  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.',
7388
7525
  inputSchema: {
7389
- projectId: z11.string().min(1).describe("Project id from studio_list_projects."),
7526
+ projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
7390
7527
  sceneFrameUrl: httpUrl.describe("Public or signed URL of ONE frame of the target shot (png/jpg)."),
7391
7528
  characterSlug: slug.optional().describe(
7392
7529
  "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."
7393
7530
  ),
7394
7531
  characterReferenceUrl: httpUrl.optional().describe("Explicit character reference image URL (use instead of characterSlug)."),
7395
7532
  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."),
7396
- 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."),
7397
- 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.'),
7398
- 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."),
7399
- motionPrompt: z11.string().optional().describe("Override the motion description for the video node."),
7400
- videoModel: z11.string().optional().describe(`Image-to-video model id. Default ${DEFAULT_SWAP_VIDEO_MODEL}, or ${KEYFRAME_SWAP_VIDEO_MODEL} when endFrameUrl is given.`),
7401
- editModel: z11.string().default(DEFAULT_SWAP_EDIT_MODEL).describe("Image-edit model id for the still swap."),
7402
- aspectRatio: z11.string().default("16:9"),
7403
- visibility: z11.enum(["listed", "unlisted"]).optional(),
7404
- acknowledgeContinuity: z11.boolean().optional().describe(
7533
+ 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."),
7534
+ 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.'),
7535
+ 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."),
7536
+ motionPrompt: z12.string().optional().describe("Override the motion description for the video node."),
7537
+ videoModel: z12.string().optional().describe(`Image-to-video model id. Default ${DEFAULT_SWAP_VIDEO_MODEL}, or ${KEYFRAME_SWAP_VIDEO_MODEL} when endFrameUrl is given.`),
7538
+ editModel: z12.string().default(DEFAULT_SWAP_EDIT_MODEL).describe("Image-edit model id for the still swap."),
7539
+ aspectRatio: z12.string().default("16:9"),
7540
+ visibility: z12.enum(["listed", "unlisted"]).optional(),
7541
+ acknowledgeContinuity: z12.boolean().optional().describe(
7405
7542
  "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."
7406
7543
  ),
7407
7544
  waitSeconds
@@ -7469,7 +7606,7 @@ var studioGetSpend = defineTool({
7469
7606
  name: "studio_get_spend",
7470
7607
  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).`,
7471
7608
  inputSchema: {
7472
- tzOffsetMinutes: z11.number().int().min(-840).max(840).optional()
7609
+ tzOffsetMinutes: z12.number().int().min(-840).max(840).optional()
7473
7610
  },
7474
7611
  annotations: { readOnlyHint: true },
7475
7612
  handler: async (args, ctx) => {
@@ -7497,7 +7634,7 @@ var studioDescribePublished = defineTool({
7497
7634
  name: "studio_describe_published",
7498
7635
  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.",
7499
7636
  inputSchema: {
7500
- slug: z11.string().min(1).describe("The recipe slug, from studio_list_published.")
7637
+ slug: z12.string().min(1).describe("The recipe slug, from studio_list_published.")
7501
7638
  },
7502
7639
  annotations: { readOnlyHint: true },
7503
7640
  handler: async (args, ctx) => {
@@ -7509,20 +7646,20 @@ var studioRunPublished = defineTool({
7509
7646
  name: "studio_run_published",
7510
7647
  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).`,
7511
7648
  inputSchema: {
7512
- slug: z11.string().min(1).describe("The recipe slug, from studio_list_published."),
7513
- projectId: z11.string().min(1).describe("Project id from studio_list_projects."),
7514
- params: z11.record(z11.string(), z11.unknown()).optional().describe("Values for the recipe's params (see studio_describe_published)."),
7515
- budgetUsd: z11.number().nonnegative().optional().describe(
7649
+ slug: z12.string().min(1).describe("The recipe slug, from studio_list_published."),
7650
+ projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
7651
+ params: z12.record(z12.string(), z12.unknown()).optional().describe("Values for the recipe's params (see studio_describe_published)."),
7652
+ budgetUsd: z12.number().nonnegative().optional().describe(
7516
7653
  '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 }.'
7517
7654
  ),
7518
- confirm: z11.boolean().optional().describe(
7655
+ confirm: z12.boolean().optional().describe(
7519
7656
  '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 }.'
7520
7657
  ),
7521
- likenessRightsConfirmed: z11.literal(true).optional().describe(`Required when the recipe creates a character; ignored otherwise. ${likenessConfirmationToolDescription()}`),
7522
- acknowledgeContinuity: z11.boolean().optional().describe(
7658
+ likenessRightsConfirmed: z12.literal(true).optional().describe(`Required when the recipe creates a character; ignored otherwise. ${likenessConfirmationToolDescription()}`),
7659
+ acknowledgeContinuity: z12.boolean().optional().describe(
7523
7660
  '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.'
7524
7661
  ),
7525
- wait: z11.boolean().default(true),
7662
+ wait: z12.boolean().default(true),
7526
7663
  waitSeconds
7527
7664
  },
7528
7665
  handler: async (args, ctx) => {
@@ -7548,6 +7685,7 @@ var TOOLS = [
7548
7685
  studioGetJob,
7549
7686
  studioListCharacters,
7550
7687
  studioGetCharacter,
7688
+ studioPromptEnhance,
7551
7689
  studioCreateCharacter,
7552
7690
  studioMintCharacter,
7553
7691
  studioCreateBrand,
@@ -7564,7 +7702,8 @@ var TOOLS = [
7564
7702
  studioGetUsage,
7565
7703
  ...WORKFLOW_TOOLS,
7566
7704
  ...MANAGE_TOOLS,
7567
- ...COMPOSITION_TOOLS
7705
+ ...COMPOSITION_TOOLS,
7706
+ ...PROMPT_TOOLS
7568
7707
  ];
7569
7708
  var TOOL_NAMES = TOOLS.map((t) => t.name);
7570
7709
  function toolResult(value) {
@@ -7582,7 +7721,7 @@ function toolError(message) {
7582
7721
  }
7583
7722
  async function invokeTool(def, args, ctx) {
7584
7723
  try {
7585
- const parsed = z11.object(def.inputSchema).parse(args ?? {});
7724
+ const parsed = z12.object(def.inputSchema).parse(args ?? {});
7586
7725
  const value = await def.handler(parsed, ctx);
7587
7726
  return toolResult(value);
7588
7727
  } catch (err) {
@@ -7633,7 +7772,7 @@ function registerTools(server, base) {
7633
7772
 
7634
7773
  // src/server.ts
7635
7774
  var SERVER_NAME = "lumitra-studio";
7636
- var SERVER_VERSION = "0.13.0";
7775
+ var SERVER_VERSION = "0.15.0";
7637
7776
  function createStudioMcpServer(opts = {}) {
7638
7777
  const config = opts.config ?? resolveConfig(opts.env ?? process.env);
7639
7778
  const client = new StudioClient(config, {