Run Blender Python
scene_scriptRun arbitrary Blender Python (bpy) against a base revision and commit the result as a new immutable revision. Policy-gated: an owner must enable scripting on the deployment first. Runs in a credential-free, network-restricted throwaway container; the runner loads the scene before your script and commits it after. Assign a JSON-serializable value to a variable named result to get it back in job_get result.scriptResult with full finite JSON retained in an immutable report up to 8 MiB. Use job_report section=report for complete stored bytes; non-JSON or oversized results are explicitly unavailable. The result variable is not predeclared: no assignment records hasResult=false, while result=None records hasResult=true with JSON null. print() output returns as result.scriptStdoutTail — both are returned in the job_get/job_wait text, so use them for introspection instead of encoding findings into object names. A script that raises commits NOTHING: the revision is only written after the whole script succeeds, so failures leave the base revision untouched. The runner evaluates the depsgraph before your first statement, so world transforms of pre-existing objects are correct on entry; objects your script CREATES keep an identity matrix_world until you call bpy.context.view_layer.update(), so measure world positions only after that call — otherwise obj.matrix_world reads zeros and any floor, bounds or framing number you derive from it is silently wrong. The environment is FIXED (Blender 5.2 LTS) — verify identifiers with docs_bpy_lookup (free, instant) instead of a probe job. Call docs_operations FIRST: the validated DSL already covers 300 operations including booleans, lathe, loft, UV unwrap, modifiers, materials, lights, cameras and render settings, and scene_apply is cheaper and safer for all of them. Reach for scripting only for shader node graphs, novel parametric generators, and computation.
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": {
"projectId": "<projectId>",
"idempotencyKey": "<idempotencyKey>",
"code": "<code>"
},
"name": "scene_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Blender Python script to run in the isolated job; owner-enabled scripting is required. | |
| message | No | Short description saved with the resulting revision. | |
| readOnly | No | Run the script for its ANSWER and commit NOTHING: no revision, no head move, no thumbnail. `result` and print() output still come back. This is the right mode for a probe — measuring, raycasting, reading node state — and it is cheaper because it skips saving and summarising the scene. scene_apply already infers this for a batch that only reads; scripting had no equivalent, so a field build's four-ray occlusion probe committed a revision it did not want. Any scene edits the script makes are DISCARDED in this mode. | |
| projectId | Yes | Stable project ID returned by project_create or projects_list. | |
| baseRevisionId | No | "HEAD" (default) targets the project's current head. Mutations MUST build on the head: passing an older revision is rejected with REVISION_CONFLICT, since history is linear. To continue from an older scene, revision_restore it forward first. | HEAD |
| idempotencyKey | Yes | Stable caller-chosen key for safe retries of this same request. | |
| generatePreview | No | Whether to render a preview of the new revision after the script succeeds. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job | Yes |