create-composition
Generate a new composition in Adobe After Effects with customizable settings, including name, dimensions, pixel aspect ratio, duration, frame rate, and background color, for streamlined project creation.
Instructions
Create a new composition in After Effects with specified parameters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| backgroundColor | No | Background color of the composition (RGB values 0-255) | |
| duration | No | Duration in seconds (default: 10.0) | |
| frameRate | No | Frame rate in frames per second (default: 30.0) | |
| height | Yes | Height of the composition in pixels | |
| name | Yes | Name of the composition | |
| pixelAspect | No | Pixel aspect ratio (default: 1.0) | |
| width | Yes | Width of the composition in pixels |
Implementation Reference
- src/index.ts:447-473 (handler)The handler function for the 'create-composition' tool. It writes the command 'createComposition' with parameters to a temp file for After Effects to execute and returns a confirmation message.async (params) => { try { // Write command to file for After Effects to pick up writeCommandFile("createComposition", params); return { content: [ { type: "text", text: `Command to create composition "${params.name}" has been queued.\n` + `Please ensure the "MCP Bridge Auto" panel is open in After Effects.\n` + `Use the "get-results" tool after a few seconds to check for results.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error queuing composition creation: ${String(error)}` } ], isError: true }; } }
- src/index.ts:434-446 (schema)Zod schema defining the input parameters for the create-composition tool, including name, dimensions, duration, frame rate, and background color.{ name: z.string().describe("Name of the composition"), width: z.number().int().positive().describe("Width of the composition in pixels"), height: z.number().int().positive().describe("Height of the composition in pixels"), pixelAspect: z.number().positive().optional().describe("Pixel aspect ratio (default: 1.0)"), duration: z.number().positive().optional().describe("Duration in seconds (default: 10.0)"), frameRate: z.number().positive().optional().describe("Frame rate in frames per second (default: 30.0)"), backgroundColor: z.object({ r: z.number().int().min(0).max(255), g: z.number().int().min(0).max(255), b: z.number().int().min(0).max(255) }).optional().describe("Background color of the composition (RGB values 0-255)") },
- src/index.ts:431-474 (registration)The server.tool() call that registers the 'create-composition' tool with its description, schema, and handler function.server.tool( "create-composition", "Create a new composition in After Effects with specified parameters", { name: z.string().describe("Name of the composition"), width: z.number().int().positive().describe("Width of the composition in pixels"), height: z.number().int().positive().describe("Height of the composition in pixels"), pixelAspect: z.number().positive().optional().describe("Pixel aspect ratio (default: 1.0)"), duration: z.number().positive().optional().describe("Duration in seconds (default: 10.0)"), frameRate: z.number().positive().optional().describe("Frame rate in frames per second (default: 30.0)"), backgroundColor: z.object({ r: z.number().int().min(0).max(255), g: z.number().int().min(0).max(255), b: z.number().int().min(0).max(255) }).optional().describe("Background color of the composition (RGB values 0-255)") }, async (params) => { try { // Write command to file for After Effects to pick up writeCommandFile("createComposition", params); return { content: [ { type: "text", text: `Command to create composition "${params.name}" has been queued.\n` + `Please ensure the "MCP Bridge Auto" panel is open in After Effects.\n` + `Use the "get-results" tool after a few seconds to check for results.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error queuing composition creation: ${String(error)}` } ], isError: true }; } } );
- src/index.ts:156-170 (helper)Supporting utility function that writes the command name and arguments to a JSON file in the system temp directory, which is monitored by the After Effects MCP bridge script.function writeCommandFile(command: string, args: Record<string, any> = {}): void { try { const commandFile = path.join(process.env.TEMP || process.env.TMP || '', 'ae_command.json'); const commandData = { command, args, timestamp: new Date().toISOString(), status: "pending" // pending, running, completed, error }; fs.writeFileSync(commandFile, JSON.stringify(commandData, null, 2)); console.error(`Command "${command}" written to ${commandFile}`); } catch (error) { console.error("Error writing command file:", error); } }