execute_python_script
Execute Python code in TouchDesigner to perform custom operations, capture output, and extend automation beyond built-in tools.
Instructions
Execute a Python script in TouchDesigner's interpreter and capture output.
Runs with the TouchDesigner API in scope plus the bundled tdapi
helpers. Returns {result, stdout, stderr}.
This runs arbitrary, un-sandboxed code in the user's TouchDesigner process — prefer the dedicated node tools for routine edits; use this for logic the other tools do not cover.
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": {
"script": "<script>"
},
"name": "execute_python_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | Python to run inside TouchDesigner. `td`, `op`, `ops`, `me`, `parent`, `project` and the `tdapi` helper library are in scope. A single expression returns its value; multi-line scripts can set `result`. | |
| response_format | No | Output format: 'json' (default) or 'markdown'. | json |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |