blender_run
Execute custom bpy Python scripts in headless Blender to handle procedural geometry, custom cleanup, baking, or batch edits, returning structured JSON results to the caller.
Instructions
POWER TOOL: run an arbitrary bpy (Python) script in headless Blender on this machine. The script gets helper globals from the Tufan preamble: ARGS (parsed k=v argv), IN/OUT (from inputFile/outputFile), emit(dict) → returns structured JSON to the caller, plus load_input()/import_any()/export_any()/mesh_objs()/tri_count()/inspect_report()/apply_all_modifiers()/select_only(). End with emit({...}) to return data. Python exceptions come back as clean tracebacks. Use blender_process for the common canned operations; this is for everything else (procedural geometry, custom cleanup, baking, batch edits). Executes native code locally — hidden in read-only mode. Needs Blender installed (auto-detected or TUFAN_BLENDER_PATH).
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": "blender_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | The bpy Python script body to execute | |
| inputFile | No | Local 3D file surfaced to the script as IN (use load_input()) | |
| outputFile | No | Path surfaced to the script as OUT | |
| factoryStartup | No | Run with --factory-startup (default true; set false to load user add-ons/extensions) | |
| timeoutSeconds | No | Max seconds for the Blender run (default 180, max 600) |