Skip to main content
Glama

Run Blender Python

scene_script
Destructive

Run 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 298 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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesBlender Python script to run in the isolated job; owner-enabled scripting is required.
messageNoShort description saved with the resulting revision.
readOnlyNoRun 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.
projectIdYesStable project ID returned by project_create or projects_list.
baseRevisionIdNo"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
idempotencyKeyYesStable caller-chosen key for safe retries of this same request.
generatePreviewNoWhether to render a preview of the new revision after the script succeeds.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
jobYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses far more than the annotations (destructiveHint=true, etc.). It details failure semantics (scripts that raise commit nothing), the result variable contract (no assignment vs result=None), the depsgraph evaluation behavior and the matrix_world pitfall, the fixed Blender 5.2 environment, and the credential-free/network-restricted container. It even explains the 8 MiB report limit and the unavailability of non-JSON/oversized results. This is a model of behavioral transparency, with no contradiction to annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but every sentence earns its place. It is front-loaded with the core purpose and then systematically covers policy, runner behavior, result handling, failure semantics, depsgraph caveats, environment, and alternatives. The structure flows logically from invocation to expectations to troubleshooting, with no redundancy or filler. It is appropriately sized for a tool with this complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is exceptionally complete. Given the tool's complexity (arbitrary Python execution, immutability, failure modes, result retrieval), it covers everything an agent needs to call it correctly: the commit-on-success guarantee, how to get results via job_get, the depsgraph warning, the fixed environment, the readOnly probe mode, and the recommended alternative. It even addresses edge cases like oversized results and identity matrix_world. Nothing essential is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the description goes beyond the schema by explaining the semantics of key parameters in context. It elaborates on the readOnly parameter's effect (discards edits, returns result/print output), the baseRevisionId behavior (MUST build on HEAD, REVISION_CONFLICT, and revision_restore as a workaround), and the result variable mechanics that interact with the code parameter. It adds meaning that the schema alone does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise statement of the tool's action: 'Run arbitrary Blender Python (bpy) against a base revision and commit the result as a new immutable revision.' It clearly identifies the verb, resource, and effect, and differentiates from scene_apply by explicitly noting that scene_apply covers 298 DSL operations and is cheaper/safer. This leaves no ambiguity about the tool's role among its siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage guidance is explicit and prescriptive: it instructs to call docs_operations FIRST, lists the 298 covered operations, and states 'Reach for scripting only for shader node graphs, novel parametric generators, and computation.' It also explains the readOnly mode for probes and when it is appropriate. This is exemplary when-to-use/when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources