Execute Blender Python
execute_blender_codeExecute Blender Python code through Blender Bridge. operation_name is required and must be a short, concrete, user-facing history title in the user's language, never a generic Run/Execute label. Persistent save/render/export work must include the structured project and outputs fields; use prepared paths through bb_output_path(kind_or_id). If Bridge returns ProjectRequired, supply the requested destination or use its suggested workspace path when file organization was delegated; ask only for a missing user choice. get_llm_instruction / blender://instructions/llm provides protocol and helper details when needed. Connection failures return their resolution. Default response_mode 'compact' returns only logs, delta, scene_digest and a slim scene snapshot (when changed). Use 'full' only for deliberate protocol diagnostics, not ordinary save/render verification. Long operations automatically return a running request_id before common MCP-host call limits; poll get_blender_operation_status instead of repeating the command. Set include_screenshot=true when the command result and the current viewport screenshot must be delivered by the same request.
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>",
"operation_name": "<operation_name>"
},
"name": "execute_blender_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| area | No | Short category identifying the part of the task for operation/history metadata. | |
| code | Yes | Python to execute in the receiving Blender; it can change the scene, files and external state. | |
| mode | No | Bridge execution mode, preview or final; preview does not make Python read-only. | |
| outputs | No | Declared persistent output files with kind and optional id, filename and explicit overwrite authorization; use prepared paths through bb_output_path. | |
| project | No | Persistent-output destination: optional name/path/workspace_root and required authorization describing the user's choice. | |
| timeout_sec | No | Blender operation execution budget in seconds, distinct from the chat host's response timeout. | |
| response_mode | No | minimal returns compact status; compact is for normal work; full is for deliberate protocol diagnostics. | |
| operation_name | Yes | Short, concrete history title in the user's language describing the requested operation. | |
| full_scene_state | No | Request full scene-state capture in the Bridge response. | |
| include_previews | No | Include available preview artifacts in the Bridge result. | |
| include_screenshot | No | Deliver a current viewport screenshot with this command result when requested. |