run
Execute Python code or scripts in Blender, preserving or resetting state; return results, printed output, and numbered errors for debugging.
Instructions
Runs code in the app's own language (Blender: Python; bpy, bmesh, mathutils ready). The namespace persists (reset=True clears it, fresh=True makes
this call a one-off). Value: the last expression or result; print output and a line-numbered error trace come back too. Script (instead of
'blender -b --python x.py -- a b'): file = path (relative: looked up in cwd first, then in the server's working directory; the answer says which one
ran), args = what follows '--', cwd, env = environment variables; it runs in a fresh namespace and cwd/env/sys.path are restored afterwards.
Background Blender: blend = open that .blend first, clean = go back to the factory scene first (both refused in a windowed Blender). grep = regex:
only the matching lines of the output are kept; if the output is cut the full text is written to a file and its path is given.
timeout = seconds (code 60, script 300): when it expires the call returns but the job continues (status says 'busy'); its result is not returned.
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": {
"app": "<app>"
},
"name": "run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | ||
| cwd | No | ||
| env | No | ||
| args | No | ||
| code | No | ||
| file | No | ||
| grep | No | ||
| blend | No | ||
| clean | No | ||
| fresh | No | ||
| reset | No | ||
| timeout | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |