Create Video Factory Job
pipeline_create_jobSet up a new AI video production job by creating a structured folder and manifest with job ID, title, prompt, platforms, style, and duration for pipeline processing.
Instructions
Create a structured job folder and manifest for an AI video production pipeline.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jobId | Yes | ||
| title | Yes | ||
| prompt | Yes | ||
| platforms | No | ||
| style | No | ||
| durationSeconds | No |
Implementation Reference
- src/tools/pipeline.ts:23-35 (handler)The async handler function that executes the pipeline_create_job tool logic: creates job folder structure (inputs, comfy, renders, ae, review, publish), writes a manifest.json with all input fields plus createdAt and status, and returns the result or error.
async (input) => { try { const jobRoot = safePath(`jobs/${input.jobId}`); for (const dir of ['inputs', 'comfy', 'renders', 'ae', 'review', 'publish']) { await fs.mkdir(path.join(jobRoot, dir), { recursive: true }); } const manifest = { ...input, createdAt: new Date().toISOString(), status: 'created' }; await writeJsonFile(path.join(jobRoot, 'manifest.json'), manifest); return textResult({ ok: true, jobRoot, manifestPath: `jobs/${input.jobId}/manifest.json`, manifest }); } catch (err) { return errorResult('Failed to create pipeline job', String(err)); } } - src/tools/pipeline.ts:12-22 (schema)The inputSchema definition for pipeline_create_job using Zod: validates jobId (alphanumeric+hyphen+underscore), title, prompt, platforms (array of platform enums with default ['douyin']), optional style, and durationSeconds (positive max 300, default 8).
title: 'Create Video Factory Job', description: 'Create a structured job folder and manifest for an AI video production pipeline.', inputSchema: z.object({ jobId: z.string().regex(/^[a-zA-Z0-9_-]+$/), title: z.string(), prompt: z.string(), platforms: z.array(z.enum(['douyin', 'xiaohongshu', 'bilibili', 'youtube_shorts', 'tiktok'])).default(['douyin']), style: z.string().optional(), durationSeconds: z.number().positive().max(300).default(8) }) }, - src/tools/pipeline.ts:9-36 (registration)Registration of the 'pipeline_create_job' tool via server.registerTool() within the registerPipelineTools function, which is called from src/index.ts line 23.
server.registerTool( 'pipeline_create_job', { title: 'Create Video Factory Job', description: 'Create a structured job folder and manifest for an AI video production pipeline.', inputSchema: z.object({ jobId: z.string().regex(/^[a-zA-Z0-9_-]+$/), title: z.string(), prompt: z.string(), platforms: z.array(z.enum(['douyin', 'xiaohongshu', 'bilibili', 'youtube_shorts', 'tiktok'])).default(['douyin']), style: z.string().optional(), durationSeconds: z.number().positive().max(300).default(8) }) }, async (input) => { try { const jobRoot = safePath(`jobs/${input.jobId}`); for (const dir of ['inputs', 'comfy', 'renders', 'ae', 'review', 'publish']) { await fs.mkdir(path.join(jobRoot, dir), { recursive: true }); } const manifest = { ...input, createdAt: new Date().toISOString(), status: 'created' }; await writeJsonFile(path.join(jobRoot, 'manifest.json'), manifest); return textResult({ ok: true, jobRoot, manifestPath: `jobs/${input.jobId}/manifest.json`, manifest }); } catch (err) { return errorResult('Failed to create pipeline job', String(err)); } } ); - src/config.ts:28-35 (helper)The safePath helper used in the handler to resolve job paths safely under VIDEO_FACTORY_ROOT, preventing path traversal.
export function safePath(input: string) { ensureRoot(); const resolved = path.resolve(config.root, input); if (!resolved.startsWith(config.root)) { throw new Error(`Path escapes VIDEO_FACTORY_ROOT: ${input}`); } return resolved; } - src/utils.ts:10-13 (helper)The writeJsonFile helper used to write the manifest.json file.
export async function writeJsonFile(filePath: string, data: unknown) { await fs.mkdir(path.dirname(filePath), { recursive: true }); await fs.writeFile(filePath, JSON.stringify(data, null, 2), 'utf8'); }