blender_execute_python
Execute Blender Python (bpy) scripts in a live GUI or headless mode to automate scene setup, modeling, and rendering. Set RESULT to return structured JSON.
Instructions
Execute arbitrary Blender Python (bpy) script in Live GUI or Headless Blender. Set RESULT = {...} inside your code to return structured JSON.
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": "blender_execute_python"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python script using bpy (configure_cycles_gpu, apply_material_preset, hex_to_rgba helpers are pre-injected). | |
| mode | No | Execution mode: auto (live GUI if open, else headless), live, or headless. | |
| blend_file | No | Optional existing .blend file to open in headless mode (original is never overwritten unless save_blend_path equals it). | |
| save_blend_path | No | Optional output .blend file path to save the scene after the operation. |