Render After Effects Template
ae_render_templateRender After Effects compositions using aerender command-line tool. Verify commands with dry-run option before executing full render.
Instructions
Invoke aerender to render an AE comp. Use dryRun first to verify command.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | ||
| compName | Yes | ||
| outputPath | Yes | ||
| aerenderBin | No | ||
| dryRun | No |
Implementation Reference
- src/tools/ae.ts:99-125 (registration)The tool 'ae_render_template' is registered on the MCP server using server.registerTool() with its schema and handler defined inline.
server.registerTool( 'ae_render_template', { title: 'Render After Effects Template', description: 'Invoke aerender to render an AE comp. Use dryRun first to verify command.', inputSchema: z.object({ projectPath: z.string(), compName: z.string(), outputPath: z.string(), aerenderBin: z.string().optional(), dryRun: z.boolean().default(true) }) }, async ({ projectPath, compName, outputPath, aerenderBin, dryRun }) => { try { const bin = aerenderBin || config.aerenderBin; if (!bin) return errorResult('AERENDER_BIN is not configured'); const args = ['-project', safePath(projectPath), '-comp', compName, '-output', safePath(outputPath)]; if (dryRun) return textResult({ dryRun: true, command: [bin, ...args].join(' ') }); const result = await runCommand(bin, args); if (result.code !== 0) return errorResult('aerender failed', result.stderr); return textResult({ ok: true, outputPath, stdout: result.stdout }); } catch (err) { return errorResult('Failed to render AE template', String(err)); } } ); - src/tools/ae.ts:112-124 (handler)The handler function for 'ae_render_template'. It resolves the aerender binary, builds CLI args, optionally does a dry run, or executes aerender via runCommand and returns the result.
async ({ projectPath, compName, outputPath, aerenderBin, dryRun }) => { try { const bin = aerenderBin || config.aerenderBin; if (!bin) return errorResult('AERENDER_BIN is not configured'); const args = ['-project', safePath(projectPath), '-comp', compName, '-output', safePath(outputPath)]; if (dryRun) return textResult({ dryRun: true, command: [bin, ...args].join(' ') }); const result = await runCommand(bin, args); if (result.code !== 0) return errorResult('aerender failed', result.stderr); return textResult({ ok: true, outputPath, stdout: result.stdout }); } catch (err) { return errorResult('Failed to render AE template', String(err)); } } - src/tools/ae.ts:100-111 (schema)The input schema for ae_render_template using Zod: projectPath, compName, outputPath, optional aerenderBin, and dryRun (default true).
'ae_render_template', { title: 'Render After Effects Template', description: 'Invoke aerender to render an AE comp. Use dryRun first to verify command.', inputSchema: z.object({ projectPath: z.string(), compName: z.string(), outputPath: z.string(), aerenderBin: z.string().optional(), dryRun: z.boolean().default(true) }) }, - src/config.ts:12-12 (helper)Configuration for aerenderBin read from environment variable AERENDER_BIN, used by the handler.
aerenderBin: process.env.AERENDER_BIN ?? '', - src/utils.ts:15-24 (helper)The runCommand helper that spawns a child process and returns stdout/stderr/exit code, used to invoke the aerender binary.
export function runCommand(command: string, args: string[], cwd?: string): Promise<{ code: number; stdout: string; stderr: string }> { return new Promise((resolve) => { const child = spawn(command, args, { cwd, shell: false }); let stdout = ''; let stderr = ''; child.stdout.on('data', (d) => (stdout += d.toString())); child.stderr.on('data', (d) => (stderr += d.toString())); child.on('close', (code) => resolve({ code: code ?? -1, stdout, stderr })); }); }