execute
Run ExtendScript inside a running After Effects instance and return the result as JSON, enabling custom AE automation and inspection in a single undo step.
Instructions
Run ExtendScript (ES3) inside the open After Effects and return the result as JSON.
Assign result = ... or end with an expression to return a value; a top-level return works
too. AE objects come back summarised (items, layers, properties with their values).
Helpers: log(...), describe(obj, depth), members(obj), findComp(name), findItem(name, type),
findItems(nameOrTest), activeComp(), toJSON(value).
The whole call is one undo step named undo_name ("" for none). depth limits how deep
plain objects and arrays are expanded (default 3). timeout is in seconds.
Example: var comp = app.project.items.addComp("Main", 1920, 1080, 1, 10, 24); var s = comp.layers.addSolid([0.1, 0.1, 0.1], "BG", 1920, 1080, 1); s.transform.opacity.setValuesAtTimes([0, 1], [0, 100]); result = {comp: comp, layers: comp.numLayers};
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": "execute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| depth | No | ||
| timeout | No | ||
| undo_name | No | ae-mcp |