@marlinjai/studio-mcp 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/cli.js +367 -105
- package/dist/index.d.ts +108 -3
- package/dist/index.js +367 -105
- package/examples/cursor-mcp.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -105,6 +105,37 @@ var StudioClient = class {
|
|
|
105
105
|
listProjects() {
|
|
106
106
|
return this.json("GET", "/api/v1/projects");
|
|
107
107
|
}
|
|
108
|
+
createProject(name) {
|
|
109
|
+
return this.json("POST", "/api/v1/projects", { json: { name } });
|
|
110
|
+
}
|
|
111
|
+
renameProject(projectId, name) {
|
|
112
|
+
return this.json("PATCH", `/api/v1/projects/${encodeURIComponent(projectId)}`, { json: { name } });
|
|
113
|
+
}
|
|
114
|
+
/** What a project holds, which is what deleting it would remove. */
|
|
115
|
+
describeProject(projectId) {
|
|
116
|
+
return this.json("GET", `/api/v1/projects/${encodeURIComponent(projectId)}`);
|
|
117
|
+
}
|
|
118
|
+
deleteProject(projectId) {
|
|
119
|
+
return this.json("DELETE", `/api/v1/projects/${encodeURIComponent(projectId)}`);
|
|
120
|
+
}
|
|
121
|
+
// ── Saved workflows (listing and moving; authoring lives with the workflow tools) ──
|
|
122
|
+
listWorkflows(opts = {}) {
|
|
123
|
+
return this.json("GET", `/api/v1/workflows${projectQuery(opts.projectId)}`);
|
|
124
|
+
}
|
|
125
|
+
moveWorkflow(savedId2, body) {
|
|
126
|
+
return this.json("POST", `/api/v1/workflows/${encodeURIComponent(savedId2)}/move`, { json: body });
|
|
127
|
+
}
|
|
128
|
+
// ── Campaigns ──
|
|
129
|
+
listCampaigns() {
|
|
130
|
+
return this.json("GET", "/api/campaigns");
|
|
131
|
+
}
|
|
132
|
+
/** The campaign and what deleting it would remove or keep. */
|
|
133
|
+
describeCampaign(campaignId) {
|
|
134
|
+
return this.json("GET", `/api/campaigns/${encodeURIComponent(campaignId)}`);
|
|
135
|
+
}
|
|
136
|
+
deleteCampaign(campaignId) {
|
|
137
|
+
return this.json("DELETE", `/api/campaigns/${encodeURIComponent(campaignId)}`);
|
|
138
|
+
}
|
|
108
139
|
// ── Generation jobs ──
|
|
109
140
|
/**
|
|
110
141
|
* One image job. `brandSlug` is optional: without it the image is generated
|
|
@@ -433,7 +464,7 @@ function resolveConfig(env = process.env) {
|
|
|
433
464
|
}
|
|
434
465
|
|
|
435
466
|
// src/tools.ts
|
|
436
|
-
import { z as
|
|
467
|
+
import { z as z9 } from "zod";
|
|
437
468
|
|
|
438
469
|
// ../lumitra-core/dist/models/index.js
|
|
439
470
|
var veo = (tier, label) => {
|
|
@@ -5635,10 +5666,212 @@ var WORKFLOW_TOOLS = [
|
|
|
5635
5666
|
studioWorkflowScreenshot
|
|
5636
5667
|
];
|
|
5637
5668
|
|
|
5669
|
+
// src/manageTools.ts
|
|
5670
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
5671
|
+
import { z as z8 } from "zod";
|
|
5672
|
+
var TOKEN_TTL_MS = 10 * 60 * 1e3;
|
|
5673
|
+
var ConfirmationStore = class {
|
|
5674
|
+
#tokens = /* @__PURE__ */ new Map();
|
|
5675
|
+
#now;
|
|
5676
|
+
constructor(now = Date.now) {
|
|
5677
|
+
this.#now = now;
|
|
5678
|
+
}
|
|
5679
|
+
issue(subject) {
|
|
5680
|
+
this.#sweep();
|
|
5681
|
+
const token = randomUUID2();
|
|
5682
|
+
this.#tokens.set(token, { subject, expiresAt: this.#now() + TOKEN_TTL_MS });
|
|
5683
|
+
return token;
|
|
5684
|
+
}
|
|
5685
|
+
/** True once for a live token issued for exactly this subject; the token is spent either way. */
|
|
5686
|
+
redeem(token, subject) {
|
|
5687
|
+
this.#sweep();
|
|
5688
|
+
const entry = this.#tokens.get(token);
|
|
5689
|
+
if (!entry) return false;
|
|
5690
|
+
this.#tokens.delete(token);
|
|
5691
|
+
return entry.subject === subject;
|
|
5692
|
+
}
|
|
5693
|
+
#sweep() {
|
|
5694
|
+
const now = this.#now();
|
|
5695
|
+
for (const [token, entry] of this.#tokens) if (entry.expiresAt <= now) this.#tokens.delete(token);
|
|
5696
|
+
}
|
|
5697
|
+
};
|
|
5698
|
+
function count(n, one, many) {
|
|
5699
|
+
return `${n} ${n === 1 ? one : many}`;
|
|
5700
|
+
}
|
|
5701
|
+
function projectDeleteSummary(c) {
|
|
5702
|
+
const removed = [
|
|
5703
|
+
c.workflows > 0 ? count(c.workflows, "saved workflow", "saved workflows") : null,
|
|
5704
|
+
c.runs > 0 ? count(c.runs, "run with its results", "runs with their results") : null,
|
|
5705
|
+
c.assets > 0 ? count(c.assets, "image, video or other asset", "images, videos and other assets") : null,
|
|
5706
|
+
c.chats > 0 ? count(c.chats, "chat", "chats") : null
|
|
5707
|
+
].filter((line) => line !== null);
|
|
5708
|
+
const parts = [
|
|
5709
|
+
`Delete the project "${c.project.name}" for everyone in the company?`,
|
|
5710
|
+
removed.length > 0 ? `This permanently removes ${removed.join(", ")}.` : "The project is empty: only the project itself is removed."
|
|
5711
|
+
];
|
|
5712
|
+
if (c.publishedWorkflows > 0) {
|
|
5713
|
+
parts.push(`${count(c.publishedWorkflows, "of its workflows is", "of its workflows are")} published as a recipe; the published address stops working.`);
|
|
5714
|
+
}
|
|
5715
|
+
if (c.campaignShots > 0) {
|
|
5716
|
+
parts.push(`${count(c.campaignShots, "campaign shot", "campaign shots")} in ${count(c.campaigns, "campaign", "campaigns")} will lose their image (the campaigns stay).`);
|
|
5717
|
+
}
|
|
5718
|
+
parts.push("The record of what the project cost is kept. This cannot be undone.");
|
|
5719
|
+
return parts.join(" ");
|
|
5720
|
+
}
|
|
5721
|
+
function campaignDeleteSummary(c) {
|
|
5722
|
+
const kept = c.imagesKept > 0 ? ` Its ${count(c.imagesKept, "image stays", "images stay")} in the asset library.` : "";
|
|
5723
|
+
return `Delete the campaign "${c.name}" with its ${count(c.shots, "shot", "shots")} and every approve and reject decision?${kept} This cannot be undone.`;
|
|
5724
|
+
}
|
|
5725
|
+
function projectSubject(c) {
|
|
5726
|
+
return ["delete-project", c.project.id, c.project.name, c.workflows, c.publishedWorkflows, c.runs, c.assets, c.chats, c.campaignShots].join(":");
|
|
5727
|
+
}
|
|
5728
|
+
function campaignSubject(c) {
|
|
5729
|
+
return ["delete-campaign", c.id, c.name, c.shots, c.imagesKept].join(":");
|
|
5730
|
+
}
|
|
5731
|
+
var NOT_CONFIRMED_INSTRUCTION = "Nothing was deleted. Show `summary` to the person exactly as written and ask them to confirm in the chat. Only after they explicitly say yes, call this tool again with the same id and `confirmationToken`. Never confirm on their behalf, and never reuse a token for anything else; it expires in ten minutes.";
|
|
5732
|
+
async function confirmWithPerson(ctx, summary, subject, token) {
|
|
5733
|
+
const outcome = ctx.confirm ? await ctx.confirm(summary) : "unavailable";
|
|
5734
|
+
if (outcome === "confirmed") return "proceed";
|
|
5735
|
+
if (outcome === "declined") {
|
|
5736
|
+
return { deleted: false, declined: true, summary, message: "The person declined in the confirmation dialog. Nothing was deleted." };
|
|
5737
|
+
}
|
|
5738
|
+
const store = ctx.confirmations;
|
|
5739
|
+
if (!store) {
|
|
5740
|
+
return { deleted: false, summary, message: "This client cannot ask the person to confirm, so nothing was deleted. Delete it in the Studio app instead." };
|
|
5741
|
+
}
|
|
5742
|
+
if (token && store.redeem(token, subject)) return "proceed";
|
|
5743
|
+
return {
|
|
5744
|
+
deleted: false,
|
|
5745
|
+
confirmationRequired: true,
|
|
5746
|
+
summary,
|
|
5747
|
+
confirmationToken: store.issue(subject),
|
|
5748
|
+
...token ? { note: "The token given was unknown, expired, already used, or what it confirmed has changed since. Ask the person again with this summary." } : {},
|
|
5749
|
+
instruction: NOT_CONFIRMED_INSTRUCTION
|
|
5750
|
+
};
|
|
5751
|
+
}
|
|
5752
|
+
function roleRefusal(err, sentence) {
|
|
5753
|
+
if (err instanceof StudioApiError && err.status === 403) {
|
|
5754
|
+
return { deleted: false, message: `${sentence} Nothing was deleted. Ask a person with that role to do it in the Studio app, or use a key with that role.` };
|
|
5755
|
+
}
|
|
5756
|
+
throw err;
|
|
5757
|
+
}
|
|
5758
|
+
var confirmationToken = z8.string().min(1).optional().describe(
|
|
5759
|
+
"Only for a client that cannot show a confirmation dialog: the confirmationToken a previous call returned, sent after the person said yes in the chat to the summary it came with."
|
|
5760
|
+
);
|
|
5761
|
+
var studioCreateProject = defineTool({
|
|
5762
|
+
name: "studio_create_project",
|
|
5763
|
+
description: "Create a project in your company: a workspace that keeps saved workflows, runs, assets and chats together (characters, products, locations, brands and campaigns are shared by every project). Only a name is needed; its slug is derived. A name the company already uses is refused (409 name_taken). Returns the project with its id, for projectId on the other tools.",
|
|
5764
|
+
inputSchema: { name: z8.string().min(1).max(120).describe("The project name, as people in the company will see it.") },
|
|
5765
|
+
handler: async (args, ctx) => (await ctx.client.createProject(args.name)).project
|
|
5766
|
+
});
|
|
5767
|
+
var studioRenameProject = defineTool({
|
|
5768
|
+
name: "studio_rename_project",
|
|
5769
|
+
description: `Rename a project of your company (any member may). The slug follows the new name, except for the company's default project, which keeps the slug "default". A name another project of the company uses is refused (409 name_taken).`,
|
|
5770
|
+
inputSchema: {
|
|
5771
|
+
projectId: z8.string().min(1).describe("The project, from studio_list_projects."),
|
|
5772
|
+
name: z8.string().min(1).max(120).describe("The new name.")
|
|
5773
|
+
},
|
|
5774
|
+
annotations: { idempotentHint: true },
|
|
5775
|
+
handler: async (args, ctx) => (await ctx.client.renameProject(args.projectId, args.name)).project
|
|
5776
|
+
});
|
|
5777
|
+
var studioDeleteProject = defineTool({
|
|
5778
|
+
name: "studio_delete_project",
|
|
5779
|
+
description: "Delete a project of your company for everyone, with its saved workflows, runs, assets (and their stored files) and chats. Needs a key with the company admin role. The PERSON confirms every delete in the chat: this tool reads what would be removed and asks them 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. The company's default project cannot be deleted, nor a project with a run or generation still going; the tool says so instead. The record of what the project cost is kept (it moves to the default project).",
|
|
5780
|
+
inputSchema: {
|
|
5781
|
+
projectId: z8.string().min(1).describe("The project to delete, from studio_list_projects."),
|
|
5782
|
+
confirmationToken
|
|
5783
|
+
},
|
|
5784
|
+
annotations: { destructiveHint: true },
|
|
5785
|
+
handler: async (args, ctx) => {
|
|
5786
|
+
const contents = await ctx.client.describeProject(args.projectId);
|
|
5787
|
+
if (contents.project.isDefault) {
|
|
5788
|
+
return { deleted: false, message: `"${contents.project.name}" is the company's default project: work lands there when no other project is selected, so it cannot be deleted. It can be renamed.` };
|
|
5789
|
+
}
|
|
5790
|
+
if (contents.runsInFlight > 0 || contents.jobsInFlight > 0) {
|
|
5791
|
+
return {
|
|
5792
|
+
deleted: false,
|
|
5793
|
+
message: `${count(contents.runsInFlight, "run is", "runs are")} still going and ${count(contents.jobsInFlight, "generation is", "generations are")} still rendering in "${contents.project.name}". Wait until they finish (or stop the runs), then delete it.`
|
|
5794
|
+
};
|
|
5795
|
+
}
|
|
5796
|
+
const summary = projectDeleteSummary(contents);
|
|
5797
|
+
const gate = await confirmWithPerson(ctx, summary, projectSubject(contents), args.confirmationToken);
|
|
5798
|
+
if (gate !== "proceed") return gate;
|
|
5799
|
+
try {
|
|
5800
|
+
const res = await ctx.client.deleteProject(args.projectId);
|
|
5801
|
+
return { deleted: true, project: res.project, fallbackProjectId: res.fallbackProjectId, summary };
|
|
5802
|
+
} catch (err) {
|
|
5803
|
+
return roleRefusal(err, "Deleting a project needs a key with the company admin role; this key does not have it.");
|
|
5804
|
+
}
|
|
5805
|
+
}
|
|
5806
|
+
});
|
|
5807
|
+
var studioListWorkflows = defineTool({
|
|
5808
|
+
name: "studio_list_workflows",
|
|
5809
|
+
description: "List the saved workflows of one project (savedId, label, version). Omit projectId for the company's default project. Use the savedId with studio_workflow_get, studio_run_workflow or studio_move_workflow.",
|
|
5810
|
+
inputSchema: { projectId: z8.string().min(1).optional().describe("The project, from studio_list_projects. Omit for the default project.") },
|
|
5811
|
+
annotations: { readOnlyHint: true },
|
|
5812
|
+
handler: async (args, ctx) => {
|
|
5813
|
+
const { workflows } = await ctx.client.listWorkflows(args.projectId ? { projectId: args.projectId } : {});
|
|
5814
|
+
return { workflows: workflows.map((w) => ({ savedId: w.savedId, label: w.label, ...w.version !== void 0 ? { version: w.version } : {} })) };
|
|
5815
|
+
}
|
|
5816
|
+
});
|
|
5817
|
+
var studioMoveWorkflow = defineTool({
|
|
5818
|
+
name: "studio_move_workflow",
|
|
5819
|
+
description: "Move a saved workflow to another project of your company, together with its runs, their jobs and the assets they produced, so every node keeps its results and nothing has to be generated again. Reversible: move it back the same way. projectId is the project it is in now (omit for the default project); toProjectId is required. Refused while a run of the workflow is still going (409 run_in_flight), and for a project of another company (404).",
|
|
5820
|
+
inputSchema: {
|
|
5821
|
+
savedId: z8.string().min(1).describe('The saved workflow, from studio_list_workflows (starts with "saved:").'),
|
|
5822
|
+
toProjectId: z8.string().min(1).describe("The project to move it to, from studio_list_projects."),
|
|
5823
|
+
projectId: z8.string().min(1).optional().describe("The project the workflow is in now. Omit for the default project.")
|
|
5824
|
+
},
|
|
5825
|
+
handler: async (args, ctx) => ctx.client.moveWorkflow(args.savedId, { toProjectId: args.toProjectId, ...args.projectId ? { projectId: args.projectId } : {} })
|
|
5826
|
+
});
|
|
5827
|
+
var studioListCampaigns = defineTool({
|
|
5828
|
+
name: "studio_list_campaigns",
|
|
5829
|
+
description: "List your company's campaigns, newest first (id, name, studio, shot count, created). Campaigns are shared by every project of the company.",
|
|
5830
|
+
inputSchema: {},
|
|
5831
|
+
annotations: { readOnlyHint: true },
|
|
5832
|
+
handler: async (_args, ctx) => ctx.client.listCampaigns()
|
|
5833
|
+
});
|
|
5834
|
+
var studioDeleteCampaign = defineTool({
|
|
5835
|
+
name: "studio_delete_campaign",
|
|
5836
|
+
description: "Delete a campaign of your company with its shot list and every approve and reject decision. Its images stay in the asset library. The PERSON confirms every delete in the chat: this tool shows them what goes and what stays 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. Refused while a shot is still rendering; the tool says so instead.",
|
|
5837
|
+
inputSchema: {
|
|
5838
|
+
campaignId: z8.string().min(1).describe("The campaign, from studio_list_campaigns."),
|
|
5839
|
+
confirmationToken
|
|
5840
|
+
},
|
|
5841
|
+
annotations: { destructiveHint: true },
|
|
5842
|
+
handler: async (args, ctx) => {
|
|
5843
|
+
const contents = await ctx.client.describeCampaign(args.campaignId);
|
|
5844
|
+
if (contents.shotsRendering > 0) {
|
|
5845
|
+
return {
|
|
5846
|
+
deleted: false,
|
|
5847
|
+
message: `${count(contents.shotsRendering, "shot is", "shots are")} of "${contents.name}" still rendering. Wait until they finish, then delete the campaign.`
|
|
5848
|
+
};
|
|
5849
|
+
}
|
|
5850
|
+
const summary = campaignDeleteSummary(contents);
|
|
5851
|
+
const gate = await confirmWithPerson(ctx, summary, campaignSubject(contents), args.confirmationToken);
|
|
5852
|
+
if (gate !== "proceed") return gate;
|
|
5853
|
+
try {
|
|
5854
|
+
const res = await ctx.client.deleteCampaign(args.campaignId);
|
|
5855
|
+
return { deleted: true, id: res.id, shotsDeleted: res.shotsDeleted, summary };
|
|
5856
|
+
} catch (err) {
|
|
5857
|
+
return roleRefusal(err, "Deleting a campaign needs a key with at least the company member role; this key does not have it.");
|
|
5858
|
+
}
|
|
5859
|
+
}
|
|
5860
|
+
});
|
|
5861
|
+
var MANAGE_TOOLS = [
|
|
5862
|
+
studioCreateProject,
|
|
5863
|
+
studioRenameProject,
|
|
5864
|
+
studioDeleteProject,
|
|
5865
|
+
studioListWorkflows,
|
|
5866
|
+
studioMoveWorkflow,
|
|
5867
|
+
studioListCampaigns,
|
|
5868
|
+
studioDeleteCampaign
|
|
5869
|
+
];
|
|
5870
|
+
|
|
5638
5871
|
// src/tools.ts
|
|
5639
|
-
var slug =
|
|
5640
|
-
var waitSeconds =
|
|
5641
|
-
var httpUrl =
|
|
5872
|
+
var slug = z9.string().regex(/^[a-z0-9-]+$/, "lowercase letters, numbers and hyphens only").describe("URL-safe identifier: lowercase letters, numbers, hyphens.");
|
|
5873
|
+
var waitSeconds = z9.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.");
|
|
5874
|
+
var httpUrl = z9.string().url().refine((u) => /^https?:\/\//i.test(u), "must be an http(s) URL");
|
|
5642
5875
|
function pollOpts(ctx, timeoutSec) {
|
|
5643
5876
|
return { ...ctx.poll, timeoutMs: timeoutSec * 1e3 };
|
|
5644
5877
|
}
|
|
@@ -5714,22 +5947,22 @@ var studioGenerateImage = defineTool({
|
|
|
5714
5947
|
brandSlug: slug.optional().describe(
|
|
5715
5948
|
"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."
|
|
5716
5949
|
),
|
|
5717
|
-
brandMode:
|
|
5718
|
-
prompt:
|
|
5950
|
+
brandMode: z9.string().optional().describe('Optional brand mode (e.g. "illustration"); modes are defined per brand. Only meaningful with brandSlug.'),
|
|
5951
|
+
prompt: z9.string().min(1).describe("What to generate. With brandSlug, the brand style prefix is prepended server-side."),
|
|
5719
5952
|
characterSlug: slug.optional().describe(
|
|
5720
5953
|
"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."
|
|
5721
5954
|
),
|
|
5722
|
-
projectId:
|
|
5955
|
+
projectId: z9.string().min(1).optional().describe(
|
|
5723
5956
|
'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.'
|
|
5724
5957
|
),
|
|
5725
|
-
model:
|
|
5726
|
-
aspectRatio:
|
|
5727
|
-
imageSize:
|
|
5728
|
-
seed:
|
|
5729
|
-
candidateCount:
|
|
5958
|
+
model: z9.string().optional().describe('Image model id (e.g. "kie/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default.'),
|
|
5959
|
+
aspectRatio: z9.string().optional().describe('Aspect ratio such as "1:1", "16:9", "3:4".'),
|
|
5960
|
+
imageSize: z9.string().optional().describe('Provider size hint, e.g. "1K", "2K".'),
|
|
5961
|
+
seed: z9.number().int().optional(),
|
|
5962
|
+
candidateCount: z9.number().int().min(1).max(4).optional().describe(
|
|
5730
5963
|
"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."
|
|
5731
5964
|
),
|
|
5732
|
-
wait:
|
|
5965
|
+
wait: z9.boolean().default(true).describe("Poll until the job finishes (default true)."),
|
|
5733
5966
|
waitSeconds
|
|
5734
5967
|
},
|
|
5735
5968
|
handler: async (args, ctx) => {
|
|
@@ -5765,23 +5998,23 @@ var studioGenerate3d = defineTool({
|
|
|
5765
5998
|
name: "studio_generate_3d",
|
|
5766
5999
|
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.",
|
|
5767
6000
|
inputSchema: {
|
|
5768
|
-
prompt:
|
|
6001
|
+
prompt: z9.string().min(1).max(1024).describe("What to model. With imageUrl, a short description of the object in the image."),
|
|
5769
6002
|
imageUrl: httpUrl.optional().describe("Public http(s) URL of one image to model from. Selects an image model."),
|
|
5770
|
-
model:
|
|
5771
|
-
options:
|
|
5772
|
-
enableTexture:
|
|
5773
|
-
enablePbr:
|
|
5774
|
-
textureQuality:
|
|
5775
|
-
geometryQuality:
|
|
5776
|
-
quadRemesh:
|
|
5777
|
-
smartLowPoly:
|
|
5778
|
-
resolution:
|
|
5779
|
-
targetPolycount:
|
|
5780
|
-
topology:
|
|
5781
|
-
seed:
|
|
6003
|
+
model: z9.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)."),
|
|
6004
|
+
options: z9.object({
|
|
6005
|
+
enableTexture: z9.boolean().optional().describe("Texture the mesh (default true). Off gives bare geometry and costs less."),
|
|
6006
|
+
enablePbr: z9.boolean().optional().describe("Physically-based rendering (PBR) material maps. Default on for Hunyuan Pro, off elsewhere."),
|
|
6007
|
+
textureQuality: z9.enum(["standard", "detailed"]).optional().describe("Tripo texture tier. detailed costs more."),
|
|
6008
|
+
geometryQuality: z9.enum(["standard", "detailed"]).optional().describe("Tripo geometry tier. detailed costs more."),
|
|
6009
|
+
quadRemesh: z9.boolean().optional().describe("Tripo: quad topology instead of triangles."),
|
|
6010
|
+
smartLowPoly: z9.boolean().optional().describe("Tripo text-to-3D: a low-poly mesh."),
|
|
6011
|
+
resolution: z9.enum(["512", "1024", "1536"]).optional().describe("TRELLIS.2 resolution (default 1024)."),
|
|
6012
|
+
targetPolycount: z9.number().int().min(100).max(15e5).optional().describe("Target face count, where the model supports one."),
|
|
6013
|
+
topology: z9.enum(["quad", "triangle"]).optional().describe("Hunyuan Pro polygon type."),
|
|
6014
|
+
seed: z9.number().int().optional()
|
|
5782
6015
|
}).optional().describe("Model-specific quality flags. Each changes the price; the returned costUsd is the price of the request that was sent."),
|
|
5783
|
-
projectId:
|
|
5784
|
-
wait:
|
|
6016
|
+
projectId: z9.string().min(1).optional().describe("Project to file the model under (from studio_list_projects). Omit for the default project."),
|
|
6017
|
+
wait: z9.boolean().default(true).describe("Poll until the job finishes (default true)."),
|
|
5785
6018
|
waitSeconds
|
|
5786
6019
|
},
|
|
5787
6020
|
handler: async (args, ctx) => {
|
|
@@ -5819,8 +6052,8 @@ var studioFindAnimations = defineTool({
|
|
|
5819
6052
|
name: "studio_find_animations",
|
|
5820
6053
|
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.',
|
|
5821
6054
|
inputSchema: {
|
|
5822
|
-
query:
|
|
5823
|
-
limit:
|
|
6055
|
+
query: z9.string().describe('Words to match, e.g. "sword slash". Empty returns the first presets in library order.'),
|
|
6056
|
+
limit: z9.number().int().min(1).max(50).default(25)
|
|
5824
6057
|
},
|
|
5825
6058
|
annotations: { readOnlyHint: true },
|
|
5826
6059
|
handler: async (args) => ({ animations: searchAnimations(args.query, args.limit) })
|
|
@@ -5829,12 +6062,12 @@ var studioRig3d = defineTool({
|
|
|
5829
6062
|
name: "studio_rig_3d",
|
|
5830
6063
|
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.",
|
|
5831
6064
|
inputSchema: {
|
|
5832
|
-
projectId:
|
|
5833
|
-
meshAssetId:
|
|
5834
|
-
animations:
|
|
5835
|
-
heightMeters:
|
|
5836
|
-
visibility:
|
|
5837
|
-
wait:
|
|
6065
|
+
projectId: z9.string().min(1).describe("The project the mesh lives in (from studio_list_projects)."),
|
|
6066
|
+
meshAssetId: z9.string().min(1).describe("The Model3D asset to rig: the assetId studio_generate_3d returned."),
|
|
6067
|
+
animations: z9.array(z9.union([z9.string().min(1), z9.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.'),
|
|
6068
|
+
heightMeters: z9.number().min(0.3).max(5).optional().describe("The character's approximate height in meters (default 1.7); Meshy scales the rig to it."),
|
|
6069
|
+
visibility: z9.enum(["listed", "unlisted"]).optional(),
|
|
6070
|
+
wait: z9.boolean().default(true).describe("Poll until the rig finishes (default true)."),
|
|
5838
6071
|
waitSeconds
|
|
5839
6072
|
},
|
|
5840
6073
|
handler: async (args, ctx) => {
|
|
@@ -5891,8 +6124,8 @@ var studioGetJob = defineTool({
|
|
|
5891
6124
|
name: "studio_get_job",
|
|
5892
6125
|
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.",
|
|
5893
6126
|
inputSchema: {
|
|
5894
|
-
jobId:
|
|
5895
|
-
wait:
|
|
6127
|
+
jobId: z9.string().min(1),
|
|
6128
|
+
wait: z9.boolean().default(false).describe("Poll until terminal (default false: return the current state)."),
|
|
5896
6129
|
waitSeconds
|
|
5897
6130
|
},
|
|
5898
6131
|
annotations: { readOnlyHint: true },
|
|
@@ -5922,7 +6155,7 @@ var studioGetCharacter = defineTool({
|
|
|
5922
6155
|
}
|
|
5923
6156
|
});
|
|
5924
6157
|
var LIKENESS_REFUSAL = `${LIKENESS_CONFIRMATION_REQUIRED_CODE}: ${likenessConfirmationRequiredMessage()}`;
|
|
5925
|
-
var likenessRightsConfirmed =
|
|
6158
|
+
var likenessRightsConfirmed = z9.literal(true, { error: LIKENESS_REFUSAL }).describe(likenessConfirmationToolDescription());
|
|
5926
6159
|
function assertLikenessRightsConfirmed(value) {
|
|
5927
6160
|
if (!isLikenessRightsConfirmed(value)) throw new Error(LIKENESS_REFUSAL);
|
|
5928
6161
|
}
|
|
@@ -5930,11 +6163,11 @@ var studioCreateCharacter = defineTool({
|
|
|
5930
6163
|
name: "studio_create_character",
|
|
5931
6164
|
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.",
|
|
5932
6165
|
inputSchema: {
|
|
5933
|
-
name:
|
|
6166
|
+
name: z9.string().min(1).describe('Display name, e.g. "Bruno Hartmann".'),
|
|
5934
6167
|
slug,
|
|
5935
|
-
descriptorPrompt:
|
|
5936
|
-
negativePrompt:
|
|
5937
|
-
defaultModel:
|
|
6168
|
+
descriptorPrompt: z9.string().min(1).describe("The identity description prepended to every generation that uses this character."),
|
|
6169
|
+
negativePrompt: z9.string().optional(),
|
|
6170
|
+
defaultModel: z9.string().optional().describe("Default image model id for this character."),
|
|
5938
6171
|
likenessRightsConfirmed
|
|
5939
6172
|
},
|
|
5940
6173
|
handler: async (args, ctx) => {
|
|
@@ -5954,16 +6187,16 @@ var studioMintCharacter = defineTool({
|
|
|
5954
6187
|
name: "studio_mint_character",
|
|
5955
6188
|
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.",
|
|
5956
6189
|
inputSchema: {
|
|
5957
|
-
projectId:
|
|
5958
|
-
name:
|
|
6190
|
+
projectId: z9.string().min(1).describe("Project id from studio_list_projects."),
|
|
6191
|
+
name: z9.string().min(1).describe("Display name."),
|
|
5959
6192
|
slug,
|
|
5960
|
-
description:
|
|
5961
|
-
descriptorPrompt:
|
|
5962
|
-
negativePrompt:
|
|
5963
|
-
defaultModel:
|
|
5964
|
-
seedModel:
|
|
5965
|
-
viewModel:
|
|
5966
|
-
visibility:
|
|
6193
|
+
description: z9.string().min(10).describe("Seed identity description (face, hair, age, build, distinguishing features)."),
|
|
6194
|
+
descriptorPrompt: z9.string().optional().describe("Override for the character's stored descriptor prompt. Defaults to the description."),
|
|
6195
|
+
negativePrompt: z9.string().optional(),
|
|
6196
|
+
defaultModel: z9.string().optional(),
|
|
6197
|
+
seedModel: z9.string().optional().describe("Override the seed text-to-image model (default fal/nano-banana-2)."),
|
|
6198
|
+
viewModel: z9.string().optional().describe("Override the view image-edit model (default fal/nano-banana-2-edit)."),
|
|
6199
|
+
visibility: z9.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
|
|
5967
6200
|
likenessRightsConfirmed,
|
|
5968
6201
|
waitSeconds
|
|
5969
6202
|
},
|
|
@@ -6022,12 +6255,12 @@ var studioCreateBrand = defineTool({
|
|
|
6022
6255
|
name: "studio_create_brand",
|
|
6023
6256
|
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.",
|
|
6024
6257
|
inputSchema: {
|
|
6025
|
-
name:
|
|
6258
|
+
name: z9.string().min(1),
|
|
6026
6259
|
slug,
|
|
6027
|
-
stylePrefix:
|
|
6028
|
-
context:
|
|
6029
|
-
defaultModel:
|
|
6030
|
-
maxReferenceImages:
|
|
6260
|
+
stylePrefix: z9.string().optional().describe("Text prepended to every prompt generated under this brand."),
|
|
6261
|
+
context: z9.string().optional().describe("Markdown brand context (tone, palette, do/don't)."),
|
|
6262
|
+
defaultModel: z9.string().optional(),
|
|
6263
|
+
maxReferenceImages: z9.number().int().min(0).max(8).optional()
|
|
6031
6264
|
},
|
|
6032
6265
|
handler: async (args, ctx) => {
|
|
6033
6266
|
const { config } = await ctx.client.createBrand({
|
|
@@ -6046,11 +6279,11 @@ var studioUploadBrandReference = defineTool({
|
|
|
6046
6279
|
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.`,
|
|
6047
6280
|
inputSchema: {
|
|
6048
6281
|
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."),
|
|
6049
|
-
source:
|
|
6050
|
-
category:
|
|
6051
|
-
label:
|
|
6052
|
-
tags:
|
|
6053
|
-
score:
|
|
6282
|
+
source: z9.string().min(1).describe("Local file path or http(s) URL of an image."),
|
|
6283
|
+
category: z9.string().optional().describe('Library category, default "general".'),
|
|
6284
|
+
label: z9.string().optional().describe("Optional file name / label."),
|
|
6285
|
+
tags: z9.array(z9.string()).optional(),
|
|
6286
|
+
score: z9.number().int().min(1).max(10).optional()
|
|
6054
6287
|
},
|
|
6055
6288
|
handler: async (args, ctx) => {
|
|
6056
6289
|
const file = await loadImageSource(args.source, ctx.client);
|
|
@@ -6071,23 +6304,23 @@ var studioRunWorkflow = defineTool({
|
|
|
6071
6304
|
name: "studio_run_workflow",
|
|
6072
6305
|
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.`,
|
|
6073
6306
|
inputSchema: {
|
|
6074
|
-
projectId:
|
|
6307
|
+
projectId: z9.string().min(1).describe("Project id from studio_list_projects."),
|
|
6075
6308
|
definition: workflowDefinitionSchema.optional(),
|
|
6076
|
-
savedId:
|
|
6077
|
-
params:
|
|
6078
|
-
nodeIds:
|
|
6079
|
-
upstreamGenerations:
|
|
6309
|
+
savedId: z9.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."),
|
|
6310
|
+
params: z9.record(z9.string(), z9.unknown()).optional().describe("Values for the definition's params."),
|
|
6311
|
+
nodeIds: z9.array(z9.string()).optional().describe("Run only this subset of nodes (requires an inline `definition` or a `savedId`)."),
|
|
6312
|
+
upstreamGenerations: z9.record(z9.string(), z9.string()).optional().describe(
|
|
6080
6313
|
'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.'
|
|
6081
6314
|
),
|
|
6082
|
-
runs:
|
|
6083
|
-
visibility:
|
|
6084
|
-
budgetUsd:
|
|
6315
|
+
runs: z9.number().int().min(1).max(8).optional().describe("Repeat a node subset N times (1 to 8)."),
|
|
6316
|
+
visibility: z9.enum(["listed", "unlisted"]).optional().describe("Whether the run shows in the Studio workflow list."),
|
|
6317
|
+
budgetUsd: z9.number().nonnegative().optional().describe(
|
|
6085
6318
|
'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.'
|
|
6086
6319
|
),
|
|
6087
|
-
confirm:
|
|
6320
|
+
confirm: z9.boolean().optional().describe(
|
|
6088
6321
|
'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 }.'
|
|
6089
6322
|
),
|
|
6090
|
-
wait:
|
|
6323
|
+
wait: z9.boolean().default(true),
|
|
6091
6324
|
waitSeconds
|
|
6092
6325
|
},
|
|
6093
6326
|
handler: async (args, ctx) => {
|
|
@@ -6118,8 +6351,8 @@ var studioGetRun = defineTool({
|
|
|
6118
6351
|
name: "studio_get_run",
|
|
6119
6352
|
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.",
|
|
6120
6353
|
inputSchema: {
|
|
6121
|
-
runId:
|
|
6122
|
-
wait:
|
|
6354
|
+
runId: z9.string().min(1),
|
|
6355
|
+
wait: z9.boolean().default(false),
|
|
6123
6356
|
waitSeconds
|
|
6124
6357
|
},
|
|
6125
6358
|
annotations: { readOnlyHint: true },
|
|
@@ -6132,11 +6365,11 @@ var studioDecideJudge = defineTool({
|
|
|
6132
6365
|
name: "studio_decide_judge",
|
|
6133
6366
|
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.",
|
|
6134
6367
|
inputSchema: {
|
|
6135
|
-
runId:
|
|
6136
|
-
nodeId:
|
|
6137
|
-
verdict:
|
|
6138
|
-
candidate:
|
|
6139
|
-
reason:
|
|
6368
|
+
runId: z9.string().min(1),
|
|
6369
|
+
nodeId: z9.string().min(1),
|
|
6370
|
+
verdict: z9.enum(["approved", "rejected"]),
|
|
6371
|
+
candidate: z9.object({ generationId: z9.string().min(1), index: z9.number().int().min(0).optional() }).optional(),
|
|
6372
|
+
reason: z9.string().max(500).optional()
|
|
6140
6373
|
},
|
|
6141
6374
|
annotations: { destructiveHint: false, idempotentHint: false },
|
|
6142
6375
|
handler: async (args, ctx) => {
|
|
@@ -6152,8 +6385,8 @@ var studioGetRunOutput = defineTool({
|
|
|
6152
6385
|
name: "studio_get_run_output",
|
|
6153
6386
|
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.",
|
|
6154
6387
|
inputSchema: {
|
|
6155
|
-
runId:
|
|
6156
|
-
nodeId:
|
|
6388
|
+
runId: z9.string().min(1),
|
|
6389
|
+
nodeId: z9.string().min(1)
|
|
6157
6390
|
},
|
|
6158
6391
|
annotations: { readOnlyHint: true },
|
|
6159
6392
|
handler: async (args, ctx) => {
|
|
@@ -6165,21 +6398,21 @@ var studioReplaceCharacterInVideo = defineTool({
|
|
|
6165
6398
|
name: "studio_replace_character_in_video",
|
|
6166
6399
|
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.',
|
|
6167
6400
|
inputSchema: {
|
|
6168
|
-
projectId:
|
|
6401
|
+
projectId: z9.string().min(1).describe("Project id from studio_list_projects."),
|
|
6169
6402
|
sceneFrameUrl: httpUrl.describe("Public or signed URL of ONE frame of the target shot (png/jpg)."),
|
|
6170
6403
|
characterSlug: slug.optional().describe(
|
|
6171
6404
|
"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."
|
|
6172
6405
|
),
|
|
6173
6406
|
characterReferenceUrl: httpUrl.optional().describe("Explicit character reference image URL (use instead of characterSlug)."),
|
|
6174
6407
|
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."),
|
|
6175
|
-
scope:
|
|
6176
|
-
preserve:
|
|
6177
|
-
swapPrompt:
|
|
6178
|
-
motionPrompt:
|
|
6179
|
-
videoModel:
|
|
6180
|
-
editModel:
|
|
6181
|
-
aspectRatio:
|
|
6182
|
-
visibility:
|
|
6408
|
+
scope: z9.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."),
|
|
6409
|
+
preserve: z9.array(z9.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.'),
|
|
6410
|
+
swapPrompt: z9.string().optional().describe("A complete still-swap edit prompt of your own; replaces the composed one, so scope and preserve are then ignored."),
|
|
6411
|
+
motionPrompt: z9.string().optional().describe("Override the motion description for the video node."),
|
|
6412
|
+
videoModel: z9.string().optional().describe(`Image-to-video model id. Default ${DEFAULT_SWAP_VIDEO_MODEL}, or ${KEYFRAME_SWAP_VIDEO_MODEL} when endFrameUrl is given.`),
|
|
6413
|
+
editModel: z9.string().default(DEFAULT_SWAP_EDIT_MODEL).describe("Image-edit model id for the still swap."),
|
|
6414
|
+
aspectRatio: z9.string().default("16:9"),
|
|
6415
|
+
visibility: z9.enum(["listed", "unlisted"]).optional(),
|
|
6183
6416
|
waitSeconds
|
|
6184
6417
|
},
|
|
6185
6418
|
handler: async (args, ctx) => {
|
|
@@ -6244,7 +6477,7 @@ var studioGetSpend = defineTool({
|
|
|
6244
6477
|
name: "studio_get_spend",
|
|
6245
6478
|
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).`,
|
|
6246
6479
|
inputSchema: {
|
|
6247
|
-
tzOffsetMinutes:
|
|
6480
|
+
tzOffsetMinutes: z9.number().int().min(-840).max(840).optional()
|
|
6248
6481
|
},
|
|
6249
6482
|
annotations: { readOnlyHint: true },
|
|
6250
6483
|
handler: async (args, ctx) => {
|
|
@@ -6272,7 +6505,7 @@ var studioDescribePublished = defineTool({
|
|
|
6272
6505
|
name: "studio_describe_published",
|
|
6273
6506
|
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.",
|
|
6274
6507
|
inputSchema: {
|
|
6275
|
-
slug:
|
|
6508
|
+
slug: z9.string().min(1).describe("The recipe slug, from studio_list_published.")
|
|
6276
6509
|
},
|
|
6277
6510
|
annotations: { readOnlyHint: true },
|
|
6278
6511
|
handler: async (args, ctx) => {
|
|
@@ -6284,17 +6517,17 @@ var studioRunPublished = defineTool({
|
|
|
6284
6517
|
name: "studio_run_published",
|
|
6285
6518
|
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.`,
|
|
6286
6519
|
inputSchema: {
|
|
6287
|
-
slug:
|
|
6288
|
-
projectId:
|
|
6289
|
-
params:
|
|
6290
|
-
budgetUsd:
|
|
6520
|
+
slug: z9.string().min(1).describe("The recipe slug, from studio_list_published."),
|
|
6521
|
+
projectId: z9.string().min(1).describe("Project id from studio_list_projects."),
|
|
6522
|
+
params: z9.record(z9.string(), z9.unknown()).optional().describe("Values for the recipe's params (see studio_describe_published)."),
|
|
6523
|
+
budgetUsd: z9.number().nonnegative().optional().describe(
|
|
6291
6524
|
'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 }.'
|
|
6292
6525
|
),
|
|
6293
|
-
confirm:
|
|
6526
|
+
confirm: z9.boolean().optional().describe(
|
|
6294
6527
|
'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 }.'
|
|
6295
6528
|
),
|
|
6296
|
-
likenessRightsConfirmed:
|
|
6297
|
-
wait:
|
|
6529
|
+
likenessRightsConfirmed: z9.literal(true).optional().describe(`Required when the recipe creates a character; ignored otherwise. ${likenessConfirmationToolDescription()}`),
|
|
6530
|
+
wait: z9.boolean().default(true),
|
|
6298
6531
|
waitSeconds
|
|
6299
6532
|
},
|
|
6300
6533
|
handler: async (args, ctx) => {
|
|
@@ -6333,7 +6566,8 @@ var TOOLS = [
|
|
|
6333
6566
|
studioDescribePublished,
|
|
6334
6567
|
studioRunPublished,
|
|
6335
6568
|
studioGetUsage,
|
|
6336
|
-
...WORKFLOW_TOOLS
|
|
6569
|
+
...WORKFLOW_TOOLS,
|
|
6570
|
+
...MANAGE_TOOLS
|
|
6337
6571
|
];
|
|
6338
6572
|
var TOOL_NAMES = TOOLS.map((t) => t.name);
|
|
6339
6573
|
function toolResult(value) {
|
|
@@ -6351,14 +6585,42 @@ function toolError(message) {
|
|
|
6351
6585
|
}
|
|
6352
6586
|
async function invokeTool(def, args, ctx) {
|
|
6353
6587
|
try {
|
|
6354
|
-
const parsed =
|
|
6588
|
+
const parsed = z9.object(def.inputSchema).parse(args ?? {});
|
|
6355
6589
|
const value = await def.handler(parsed, ctx);
|
|
6356
6590
|
return toolResult(value);
|
|
6357
6591
|
} catch (err) {
|
|
6358
6592
|
return toolError(ctx.client.redact(errorMessage(err)));
|
|
6359
6593
|
}
|
|
6360
6594
|
}
|
|
6361
|
-
function
|
|
6595
|
+
function elicitConfirmation(server) {
|
|
6596
|
+
return async (message) => {
|
|
6597
|
+
if (!server.server.getClientCapabilities()?.elicitation) return "unavailable";
|
|
6598
|
+
try {
|
|
6599
|
+
const result = await server.server.elicitInput({
|
|
6600
|
+
message,
|
|
6601
|
+
requestedSchema: {
|
|
6602
|
+
type: "object",
|
|
6603
|
+
properties: {
|
|
6604
|
+
confirm: { type: "boolean", title: "Delete", description: "Yes, delete it. This cannot be undone." }
|
|
6605
|
+
},
|
|
6606
|
+
required: ["confirm"]
|
|
6607
|
+
}
|
|
6608
|
+
});
|
|
6609
|
+
return result.action === "accept" && result.content?.confirm === true ? "confirmed" : "declined";
|
|
6610
|
+
} catch (err) {
|
|
6611
|
+
const code = err?.code;
|
|
6612
|
+
if (code === METHOD_NOT_FOUND || /does not support/i.test(err instanceof Error ? err.message : "")) return "unavailable";
|
|
6613
|
+
return "declined";
|
|
6614
|
+
}
|
|
6615
|
+
};
|
|
6616
|
+
}
|
|
6617
|
+
var METHOD_NOT_FOUND = -32601;
|
|
6618
|
+
function registerTools(server, base) {
|
|
6619
|
+
const ctx = {
|
|
6620
|
+
...base,
|
|
6621
|
+
confirm: base.confirm ?? elicitConfirmation(server),
|
|
6622
|
+
confirmations: base.confirmations ?? new ConfirmationStore()
|
|
6623
|
+
};
|
|
6362
6624
|
for (const def of TOOLS) {
|
|
6363
6625
|
server.registerTool(
|
|
6364
6626
|
def.name,
|
|
@@ -6374,7 +6636,7 @@ function registerTools(server, ctx) {
|
|
|
6374
6636
|
|
|
6375
6637
|
// src/server.ts
|
|
6376
6638
|
var SERVER_NAME = "lumitra-studio";
|
|
6377
|
-
var SERVER_VERSION = "0.
|
|
6639
|
+
var SERVER_VERSION = "0.7.0";
|
|
6378
6640
|
function createStudioMcpServer(opts = {}) {
|
|
6379
6641
|
const config = opts.config ?? resolveConfig(opts.env ?? process.env);
|
|
6380
6642
|
const client = new StudioClient(config, {
|
|
@@ -6399,7 +6661,7 @@ function createStudioMcpServer(opts = {}) {
|
|
|
6399
6661
|
|
|
6400
6662
|
// src/cli.ts
|
|
6401
6663
|
import { createServer as createHttpServer } from "http";
|
|
6402
|
-
import { randomUUID as
|
|
6664
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
6403
6665
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6404
6666
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
6405
6667
|
function parseArgs(argv) {
|
|
@@ -6484,7 +6746,7 @@ async function runHttp(args) {
|
|
|
6484
6746
|
});
|
|
6485
6747
|
const addr = httpServer.address();
|
|
6486
6748
|
const port = typeof addr === "object" && addr ? addr.port : args.port;
|
|
6487
|
-
process.stderr.write(`[${SERVER_NAME}] Streamable HTTP on http://${args.host}:${port}/mcp (${TOOL_NAMES.length} tools, instance ${
|
|
6749
|
+
process.stderr.write(`[${SERVER_NAME}] Streamable HTTP on http://${args.host}:${port}/mcp (${TOOL_NAMES.length} tools, instance ${randomUUID3().slice(0, 8)})
|
|
6488
6750
|
`);
|
|
6489
6751
|
const shutdown = () => {
|
|
6490
6752
|
httpServer.close(() => process.exit(0));
|