Skip to main content
Glama

Run ExtendScript

run_script
Destructive

Execute arbitrary ExtendScript in After Effects for tasks that dedicated tools do not cover; returns the last expression and can wrap code as a function with args.

Instructions

Execute arbitrary ExtendScript (ES3 JavaScript) inside After Effects and return the value of the last expression. Use it for anything no dedicated tool covers. The full AE scripting DOM is available (app, app.project, CompItem, ...), plus the AEMCP helper library (AEMCP.getComp(ref), AEMCP.getLayer(comp, ref), AEMCP.getProp(layer, path), AEMCP.describeLayer(L), AEMCP.call('', args)). AE objects in the result are summarized to JSON. With wrapInFunction=true the code is a function body: use return, and read inputs from args. Runs inside one undo group.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "run_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNoValues passed to the function as `args` (wrapInFunction only).
codeYesExtendScript source. No let/const/arrow functions (ES3).
timeoutSecondsNoMax seconds to wait (default 60).
wrapInFunctionNoTreat code as a function body (use return).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and readOnlyHint=false; the description adds genuinely useful context beyond that: the run happens inside one undo group, ES3 restrictions apply, and AE objects in results are summarized to JSON. It stops short of saying what happens on script error or timeout (whether the undo group rolls back), which matters for a destructive tool.

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?

Front-loads the core action, then layers helper library, return serialization, wrapInFunction mode, and the undo-group note in descending priority. Every sentence conveys distinct operational information with no filler.

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

Completeness4/5

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

A complex, open-ended execution tool with no output schema and a nested args object, yet the description covers invocation modes, available APIs, return handling, and transactional behavior. The remaining gap is error/timeout semantics, which an agent would want before running a destructive script.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3; the description earns an extra point by explaining the non-obvious semantics of wrapInFunction (code becomes a function body, use `return`, inputs arrive via `args`) and echoes the ES3 constraint on code. It adds no detail on timeoutSeconds behavior beyond the schema default.

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

Purpose5/5

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

States a concrete verb and resource (execute ExtendScript inside After Effects), specifies the return contract (value of last expression), and scopes itself against all other tools with 'use it for anything no dedicated tool covers.' An agent can immediately tell this is the general-purpose escape hatch.

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

Usage Guidelines4/5

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

Gives a clear selection rule: use it when no dedicated tool covers the task. It does not name when not to use it — most notably run_script_file appears in the sibling set but is never contrasted, nor is there guidance on preferring dedicated tools for undo safety or validation.

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

Deploy Server

Other Tools