Skip to main content
Glama

Run Blender Python

scene_script
DestructiveIdempotent

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 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

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

NameRequiredDescriptionDefault
jobYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only say destructive/idempotent/not-read-only; the description adds the policy gate (owner must enable scripting), the credential-free network-restricted throwaway container, atomic commit semantics (a raising script commits NOTHING), the 8 MiB result cap with explicit unavailable cases, and the depsgraph staleness trap for newly created objects. This is materially more than the annotations convey and directly affects how an agent writes and interprets a script.

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

Conciseness4/5

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

Front-loaded with purpose then progressively narrower guidance, and nearly every sentence carries operational information (policy gate, atomic commit, matrix_world caveat, stdout tail). It is a dense single block that would scan better with sub-headings, and a few clauses (e.g. the double explanation of where scriptResult surfaces) are slightly redundant.

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?

Despite a 7-parameter tool with an output schema, the description still covers environment version, prerequisites, failure behavior, and where to find results, all of which are needed to invoke it correctly. Nothing an agent needs to decide or execute is missing.

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

Parameters3/5

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

Schema description coverage is 100% and the schema already explains readOnly's discard behavior, baseRevisionId's REVISION_CONFLICT rule and idempotencyKey, so the description adds little per-parameter. It does clarify the `result` variable contract and the hasResult true/false distinction, but that is an output convention rather than parameter meaning; baseline 3 applies.

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?

States a concrete verb and resource ("Run arbitrary Blender Python (bpy) against a base revision and commit the result as a new immutable revision") and explicitly positions itself against siblings scene_apply, docs_operations and docs_bpy_lookup. An agent can distinguish this from the validated-DSL path without opening either schema.

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?

Gives an explicit ordering rule ("Call docs_operations FIRST") and names when to use the alternative plus when not to script: DSL covers 300 operations; scripting only for shader node graphs, novel parametric generators, and computation. It also routes identifier verification to docs_bpy_lookup rather than a probe job.

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