Skip to main content
Glama

run-script

Execute predefined read-only scripts in Adobe After Effects through the MCP server, allowing controlled automation with optional parameters for tailored workflows.

Instructions

Run a read-only script in After Effects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parametersNoOptional parameters for the script
scriptYesName of the predefined script to run

Implementation Reference

  • The handler function for the 'run-script' MCP tool. It validates the script against a whitelist of allowed scripts, clears any stale results file, writes the script name and parameters to a temporary command file (ae_command.json) in the system temp directory for the After Effects MCP Bridge panel to detect and execute, and returns a text response instructing the user to check results with the 'get-results' tool.
    async ({ script, parameters = {} }) => {
      // Validate that script is safe (only allow predefined scripts)
      const allowedScripts = [
        "listCompositions", 
        "getProjectInfo", 
        "getLayerInfo", 
        "createComposition",
        "createTextLayer",
        "createShapeLayer",
        "createSolidLayer",
        "setLayerProperties",
        "setLayerKeyframe",
        "setLayerExpression",
        "applyEffect",
        "applyEffectTemplate",
        "test-animation",
        "bridgeTestEffects"
      ];
      
      if (!allowedScripts.includes(script)) {
        return {
          content: [
            {
              type: "text",
              text: `Error: Script "${script}" is not allowed. Allowed scripts are: ${allowedScripts.join(", ")}`
            }
          ],
          isError: true
        };
      }
    
      try {
        // Clear any stale result data
        clearResultsFile();
        
        // Write command to file for After Effects to pick up
        writeCommandFile(script, parameters);
        
        return {
          content: [
            {
              type: "text",
              text: `Command to run "${script}" 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 command: ${String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • The input schema for the 'run-script' tool using Zod: requires 'script' string (predefined script name), optional 'parameters' as any record.
      script: z.string().describe("Name of the predefined script to run"),
      parameters: z.record(z.any()).optional().describe("Optional parameters for the script")
    },
  • src/index.ts:212-279 (registration)
    The MCP server registration of the 'run-script' tool using server.tool(), specifying name, description, input schema, and handler function.
    server.tool(
      "run-script",
      "Run a read-only script in After Effects",
      {
        script: z.string().describe("Name of the predefined script to run"),
        parameters: z.record(z.any()).optional().describe("Optional parameters for the script")
      },
      async ({ script, parameters = {} }) => {
        // Validate that script is safe (only allow predefined scripts)
        const allowedScripts = [
          "listCompositions", 
          "getProjectInfo", 
          "getLayerInfo", 
          "createComposition",
          "createTextLayer",
          "createShapeLayer",
          "createSolidLayer",
          "setLayerProperties",
          "setLayerKeyframe",
          "setLayerExpression",
          "applyEffect",
          "applyEffectTemplate",
          "test-animation",
          "bridgeTestEffects"
        ];
        
        if (!allowedScripts.includes(script)) {
          return {
            content: [
              {
                type: "text",
                text: `Error: Script "${script}" is not allowed. Allowed scripts are: ${allowedScripts.join(", ")}`
              }
            ],
            isError: true
          };
        }
    
        try {
          // Clear any stale result data
          clearResultsFile();
          
          // Write command to file for After Effects to pick up
          writeCommandFile(script, parameters);
          
          return {
            content: [
              {
                type: "text",
                text: `Command to run "${script}" 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 command: ${String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Helper function called by the handler to serialize the script command and parameters to ae_command.json in system temp directory, which is polled by the After Effects 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);
      }
    }
  • Helper function called by the handler to reset the results file ae_mcp_result.json to a 'waiting' state before queuing a new command, preventing stale data.
    function clearResultsFile(): void {
      try {
        const resultFile = path.join(process.env.TEMP || process.env.TMP || '', 'ae_mcp_result.json');
        
        // Write a placeholder message to indicate the file is being reset
        const resetData = {
          status: "waiting",
          message: "Waiting for new result from After Effects...",
          timestamp: new Date().toISOString()
        };
        
        fs.writeFileSync(resultFile, JSON.stringify(resetData, null, 2));
        console.error(`Results file cleared at ${resultFile}`);
      } catch (error) {
        console.error("Error clearing results file:", 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 'read-only,' indicating non-destructive behavior, but lacks details on permissions, rate limits, error handling, or what 'run' entails (e.g., execution context, output format). This is insufficient for a tool with potential side effects.

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, efficient sentence with zero waste—it directly states the tool's purpose without unnecessary elaboration. It's appropriately sized and front-loaded, earning full marks for conciseness.

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 running scripts in After Effects, no annotations, and no output schema, the description is incomplete. It lacks details on script behavior, return values, error cases, or how it differs from siblings like 'run-bridge-test,' leaving significant gaps for the agent.

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 already documents both parameters ('script' and 'parameters'). The description adds no additional meaning beyond implying 'predefined scripts' from the schema's 'Name of the predefined script,' resulting in a baseline score of 3 as the schema handles the heavy lifting.

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 ('Run') and resource ('a read-only script in After Effects'), making the purpose understandable. However, it doesn't distinguish this tool from potential sibling tools like 'run-bridge-test' or other script-related tools that might exist, 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 minimal guidance by specifying 'read-only,' which implies safe usage, but offers no explicit when-to-use advice, alternatives (e.g., vs. 'run-bridge-test'), or prerequisites. Without annotations, this leaves the agent with little context for selection.

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