Skip to main content
Glama
YABlenderMCP
by dassey

execute_blender_code

Destructive

Run custom Python inside Blender to perform operations lacking dedicated tools, capture output, return structured JSON, and stop runaway code via a timeout.

Instructions

Execute arbitrary Python code inside Blender.

Pre-imported: bpy, bmesh, mathutils (Vector, Matrix, Euler, Quaternion), math, np (numpy), C (bpy.context), D (bpy.data). Stdout/stderr are captured. Assign a variable named result to get structured data back as JSON. Runaway code is stopped after timeout seconds. 3D-viewport operators work (the code runs with a viewport context). The whole run is one Ctrl+Z step. Use this for any operation that doesn't have a dedicated tool. The user can turn it off (add-on preference "Allow Python code"); then it returns an error and only the structured tools work.

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>"
    },
    "name": "execute_blender_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
timeoutNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Goes far beyond the annotations (readOnly=false, destructive=true) by disclosing execution environment (pre-imported bpy, bmesh, mathutils, math, np, C, D), stdout/stderr capture, the `result` variable contract for JSON output, timeout enforcement on runaway code, viewport context availability, and that the entire run collapses into a single undo step. The gating preference that can disable the tool is exactly the kind of environmental behavior an agent cannot infer from structured fields.

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?

Purpose is front-loaded in the first line, with supporting facts grouped after it. The density of clauses makes it a long single paragraph, but nearly every clause supplies information an agent needs before calling.

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?

For a high-risk arbitrary-code tool with a trivial two-parameter schema and an output schema already present, the description covers everything else: how results come back, how execution is bounded, what context the code runs in, and the conditions under which the tool is unavailable.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must carry the load: it explains that `timeout` bounds runaway execution (seconds implied by the default 170) and that a variable named `result` controls structured return data. `code` itself is left as self-evident; minor gaps remain around the default value and any size limits on the code string.

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?

Opens with a precise verb+resource: 'Execute arbitrary Python code inside Blender.' It immediately distinguishes itself from structured siblings by saying it is the fallback for operations without a dedicated tool, so an agent can route correctly without opening the schema.

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

Usage Guidelines4/5

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

Provides an explicit selection rule — 'Use this for any operation that doesn't have a dedicated tool' — plus a failure condition (the add-on preference being off means only structured tools work). It stops short of naming specific sibling tools to prefer, but the when-to-use guidance is clear and actionable.

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

Deploy Server

Other Tools