td_exec_python
Run Python code in TouchDesigner to control operators, evaluate parameters, and retrieve results. Supports optional timeout and hints for debugging.
Instructions
Execute Python code inside TouchDesigner.
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": "td_exec_python"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python code to execute in TouchDesigner's Python environment. Has access to: op(), ops(), project, app, absTime, me, parent(), mod, ui, tdu. Set __result__ = <value> to return a value to the caller. Example: '__result__ = op("/project1/noise1").par.type.eval()' | |
| timeout_ms | No | Optional per-call execution timeout in milliseconds. When omitted, TouchDesigner uses its configured default. Bounds: 100-60000 ms. | |
| include_hints | No | If True, attach a ``hints`` block via td_get_hints. Auto-injection still fires when the code touches restricted patterns (.text=, .par.file=, imports, OS escapes). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |