Skip to main content
Glama
BlkDem

Blender MCP Server

by BlkDem

blender.execute_python

Run Python code inside a live Blender session to create or edit objects and return structured data through the result variable.

Instructions

Execute Python inside the running Blender and return whatever the snippet left in a variable named result.

code: statements to run. import bpy, import mathutils and the standard library are available. Anything that touches the network, spawns processes, reads or writes files, or reaches for eval/exec/import is rejected with VALIDATION_ERROR before Blender is contacted. Assign a JSON-serialisable value to result to get structured data back; otherwise only a summary is returned.

  Otherwise, if the server was started with ALLOW_PYTHON_EXECUTION=false,
  the call is refused with PYTHON_EXECUTION_DISABLED without contacting Blender.

Example: import bpy bpy.ops.mesh.primitive_uv_sphere_add(location=(0, 0, 1)) obj = bpy.context.object obj.name = "Ball" result = {"created": obj.name, "verts": len(obj.data.vertices)}

This tool is meant for a trusted, local AI client. It is a policy screen, not a sandbox: Blender's own API is powerful enough to do damage, and enabling this tool should be a deliberate choice.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so richly: it names the two failure modes and their error codes (VALIDATION_ERROR, PYTHON_EXECUTION_DISABLED), the ALLOW_PYTHON_EXECUTION server flag, the exact rejected constructs, and the explicit 'policy screen, not a sandbox' caveat about Blender's own API power.

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 the purpose and the return convention, then restrictions, then error/failure conditions in a logical order. The example earns its place for a code-execution tool, though the repeated 'Otherwise' connective and the trailing policy paragraph add some length.

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 no annotations and a minimal schema, the description covers purpose, parameter conventions, failure modes, and return behavior (even though an output schema exists). An agent has everything needed to call it correctly or decide against it.

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 0% for the single `code` parameter, so the description must compensate, and it does: available imports, banned operations, the `result` assignment convention for structured output, and a worked example together give far more meaning than the bare schema.

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 specific verb and resource — execute Python inside the running Blender — and clarifies the return convention (`result` variable). It is unmistakably distinct from the structured siblings like get_objects, create_object, or render.

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

Usage Guidelines3/5

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

It signals the intended audience ('a trusted, local AI client') and warns that enabling the tool is a deliberate choice, which implies caution, but it never says when to prefer this over the structured siblings or when it is inappropriate. Usage is implied rather than routed.

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