Skip to main content
Glama

mcp_aftereffects_applyEffectTemplate

Apply predefined effect templates like Gaussian Blur, Glow, or Drop Shadow to specific layers in After Effects compositions using index-based targeting and optional custom settings.

Instructions

Apply a predefined effect template to a layer in After Effects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compIndexYes1-based index of the target composition in the project panel.
customSettingsNoOptional custom settings to override defaults.
layerIndexYes1-based index of the target layer within the composition.
templateNameYesName of the effect template to apply.

Implementation Reference

  • The complete registration and handler implementation for the 'mcp_aftereffects_applyEffectTemplate' MCP tool. It defines the input schema, registers the tool, and provides the handler logic that queues an 'applyEffectTemplate' command for the After Effects bridge script, waits for processing, reads results from a temporary file, and returns them to the MCP client.
    server.tool(
      "mcp_aftereffects_applyEffectTemplate",
      "Apply a predefined effect template to a layer in After Effects",
      {
        compIndex: z.number().int().positive().describe("1-based index of the target composition in the project panel."),
        layerIndex: z.number().int().positive().describe("1-based index of the target layer within the composition."),
        templateName: z.enum([
          "gaussian-blur", 
          "directional-blur", 
          "color-balance", 
          "brightness-contrast",
          "curves",
          "glow",
          "drop-shadow",
          "cinematic-look",
          "text-pop"
        ]).describe("Name of the effect template to apply."),
        customSettings: z.record(z.any()).optional().describe("Optional custom settings to override defaults.")
      },
      async (parameters) => {
        try {
          // Queue the command for After Effects
          writeCommandFile("applyEffectTemplate", parameters);
          
          // Wait a bit for After Effects to process the command
          await new Promise(resolve => setTimeout(resolve, 1000));
          
          // Get the results
          const result = readResultsFromTempFile();
          
          return {
            content: [
              {
                type: "text",
                text: result
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error applying effect template: ${String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Helper function used by the tool handler to write the command ('applyEffectTemplate') and parameters to a temporary JSON file ('ae_command.json') in the system temp directory, which is monitored by the After Effects MCP Bridge Auto panel.
    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);
      }
    }
  • Helper function used by the tool handler to read the results from the After Effects temp result file ('ae_mcp_result.json'), including staleness checks and warnings.
    function readResultsFromTempFile(): string {
      try {
        const tempFilePath = path.join(process.env.TEMP || process.env.TMP || '', 'ae_mcp_result.json');
        
        // Add debugging info
        console.error(`Checking for results at: ${tempFilePath}`);
        
        if (fs.existsSync(tempFilePath)) {
          // Get file stats to check modification time
          const stats = fs.statSync(tempFilePath);
          console.error(`Result file exists, last modified: ${stats.mtime.toISOString()}`);
          
          const content = fs.readFileSync(tempFilePath, 'utf8');
          console.error(`Result file content length: ${content.length} bytes`);
          
          // If the result file is older than 30 seconds, warn the user
          const thirtySecondsAgo = new Date(Date.now() - 30 * 1000);
          if (stats.mtime < thirtySecondsAgo) {
            console.error(`WARNING: Result file is older than 30 seconds. After Effects may not be updating results.`);
            return JSON.stringify({ 
              warning: "Result file appears to be stale (not recently updated).",
              message: "This could indicate After Effects is not properly writing results or the MCP Bridge Auto panel isn't running.",
              lastModified: stats.mtime.toISOString(),
              originalContent: content
            });
          }
          
          return content;
        } else {
          console.error(`Result file not found at: ${tempFilePath}`);
          return JSON.stringify({ error: "No results file found. Please run a script in After Effects first." });
        }
      } catch (error) {
        console.error("Error reading results file:", error);
        return JSON.stringify({ error: `Failed to read results: ${String(error)}` });
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool applies an effect template but doesn't explain what happens (e.g., whether it overwrites existing effects, requires specific permissions, or has side effects like modifying layer properties). This leaves critical behavioral traits undocumented.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the core action without unnecessary details. It's front-loaded and wastes no words, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of applying effects in After Effects, no annotations, and no output schema, the description is insufficient. It lacks information on behavioral outcomes (e.g., success/failure states, error handling) and doesn't address how this tool differs from siblings, leaving gaps for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't clarify how 'customSettings' interact with templates or provide examples). Baseline 3 is appropriate as the schema handles parameter semantics adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('apply') and target ('predefined effect template to a layer in After Effects'), making the purpose understandable. However, it doesn't distinguish this tool from its sibling 'mcp_aftereffects_applyEffect' or 'apply-effect-template', which appear to have similar functionality, missing explicit differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'mcp_aftereffects_applyEffect' or 'apply-effect-template'. There's no mention of prerequisites, such as needing an open project or specific layer types, leaving usage context unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dakkshin/after-effects-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server