Skip to main content
Glama

apply-effect

Apply effects to specific layers in After Effects compositions by specifying layer index, effect name or match name, and optional settings. Works with the mcp-after-effects server for streamlined automation.

Instructions

Apply an effect to a layer in After Effects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compIndexYes1-based index of the target composition in the project panel.
effectCategoryNoOptional category for filtering effects.
effectMatchNameNoAfter Effects internal name for the effect (more reliable, e.g., 'ADBE Gaussian Blur 2').
effectNameNoDisplay name of the effect to apply (e.g., 'Gaussian Blur').
effectSettingsNoOptional parameters for the effect (e.g., { 'Blurriness': 25 }).
layerIndexYes1-based index of the target layer within the composition.
presetPathNoOptional path to an effect preset file (.ffx).

Implementation Reference

  • src/index.ts:682-720 (registration)
    Registers the 'apply-effect' MCP tool with input schema, description, and handler function that queues the 'applyEffect' command to a temporary file for execution by the After Effects bridge panel.
    server.tool(
      "apply-effect",
      "Apply an effect 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."),
        effectName: z.string().optional().describe("Display name of the effect to apply (e.g., 'Gaussian Blur')."),
        effectMatchName: z.string().optional().describe("After Effects internal name for the effect (more reliable, e.g., 'ADBE Gaussian Blur 2')."),
        effectCategory: z.string().optional().describe("Optional category for filtering effects."),
        presetPath: z.string().optional().describe("Optional path to an effect preset file (.ffx)."),
        effectSettings: z.record(z.any()).optional().describe("Optional parameters for the effect (e.g., { 'Blurriness': 25 }).")
      },
      async (parameters) => {
        try {
          // Queue the command for After Effects
          writeCommandFile("applyEffect", parameters);
          
          return {
            content: [
              {
                type: "text",
                text: `Command to apply effect to layer ${parameters.layerIndex} in composition ${parameters.compIndex} has been queued.\n` +
                      `Use the "get-results" tool after a few seconds to check for confirmation.`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error queuing apply-effect command: ${String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Handler function for the 'apply-effect' tool. Writes the command parameters to ae_command.json for the After Effects MCP Bridge Auto panel to detect and execute the actual effect application.
    async (parameters) => {
      try {
        // Queue the command for After Effects
        writeCommandFile("applyEffect", parameters);
        
        return {
          content: [
            {
              type: "text",
              text: `Command to apply effect to layer ${parameters.layerIndex} in composition ${parameters.compIndex} has been queued.\n` +
                    `Use the "get-results" tool after a few seconds to check for confirmation.`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error queuing apply-effect command: ${String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod input schema defining parameters for the 'apply-effect' tool: composition and layer indices, effect names, category, preset path, and custom settings.
    {
      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."),
      effectName: z.string().optional().describe("Display name of the effect to apply (e.g., 'Gaussian Blur')."),
      effectMatchName: z.string().optional().describe("After Effects internal name for the effect (more reliable, e.g., 'ADBE Gaussian Blur 2')."),
      effectCategory: z.string().optional().describe("Optional category for filtering effects."),
      presetPath: z.string().optional().describe("Optional path to an effect preset file (.ffx)."),
      effectSettings: z.record(z.any()).optional().describe("Optional parameters for the effect (e.g., { 'Blurriness': 25 }).")
  • Helper function used by the 'apply-effect' handler to write the command and parameters to the temporary ae_command.json file, which is monitored by the After Effects bridge.
    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 to read results from the ae_mcp_result.json file produced by After Effects after executing the applyEffect command. Used in companion 'get-results' tool.
    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. While 'apply' implies a write/mutation operation, the description doesn't address important behavioral aspects like whether this requires specific permissions, what happens if the effect already exists, whether the operation is reversible, or what happens on failure. For a mutation tool with zero annotation coverage, this is inadequate.

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 extremely concise - a single sentence that directly states the tool's purpose without any unnecessary words. It's front-loaded with the essential information and contains zero wasted content.

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?

For a mutation tool with 7 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't address behavioral aspects, doesn't explain what happens after the effect is applied, doesn't mention error conditions, and doesn't differentiate from similar sibling tools. The description leaves too many contextual gaps for effective tool selection and invocation.

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?

The schema description coverage is 100%, meaning all 7 parameters are documented in the schema itself. The description doesn't add any meaningful parameter semantics beyond what's already in the schema. According to the scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter information in the description.

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 an effect') and target ('to a layer in After Effects'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from sibling tools like 'apply-effect-template' or 'mcp_aftereffects_applyEffect', which appear to have similar functionality.

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. With multiple sibling tools that appear related to applying effects (apply-effect-template, mcp_aftereffects_applyEffect, mcp_aftereffects_applyEffectTemplate), there's no indication of when this specific tool is appropriate versus those alternatives.

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