Skip to main content
Glama

execute_blender_python

Run custom Python code inside Blender for advanced operations like bmesh surgery, geometry nodes, and bulk edits when structured tools aren't enough.

Instructions

Run Python inside Blender on the main thread. The escape hatch.

Use this when the structured tools cannot express what you need: bmesh surgery, geometry nodes, uncommon operators, bulk edits. Prefer the structured tools when they fit -- they validate inputs and return tidy results.

Captures stdout and stderr, returns the traceback on failure, and reports which objects appeared or disappeared. Assign to a variable named result (or pass return_expression) to send a value back.

This is TRUSTED LOCAL EXECUTION: the code has the same reach as Blender's own scripting console, in the user's live session. There is no shell tool, no subprocess and no outbound network in this bridge -- do not try to add them here.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython source. bpy, bmesh, mathutils, math, random, Vector, Matrix, Euler, Quaternion, C (context) and D (data) are already in scope.
ignore_errorsNoReport an exception in the result instead of failing the call
return_expressionNoExpression evaluated after the code runs; its value is returned as result_repr

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.9/5.0
Behavior5/5

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

No annotations exist, so the description carries the full disclosure burden — and it delivers extensively. It reveals main-thread execution, stdout/stderr capture, traceback-on-failure, appeared/disappeared object reporting, the result-return mechanism, and a stark security note that this is TRUSTED LOCAL EXECUTION with the reach of the scripting console, explicitly warning against trying to add shell, subprocess, or network capabilities. Exceptional for a high-risk tool.

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?

Four short paragraphs, each with a distinct job: core purpose, usage routing, behavioral details, and security boundary. The most important information (what it is, when to use it) is front-loaded. Every sentence earns its place — the security warning is essential for a trusted-execution tool, and the structure keeps it scannable.

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 having no output schema, the description fully explains return semantics (result_repr via return_expression, traceback on failure, captured stdout/stderr). For the most complex and powerful tool in the set, an agent has everything needed to call it safely and correctly: what it does, when to prefer it, how to return values, and what the security constraints are.

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 coverage is 100%, so parameters are already documented. The description adds genuine value by connecting the mechanism: 'Assign to a variable named result (or pass return_expression) to send a value back,' which clarifies how code and return_expression interact to produce the return value — beyond what the bare schema states. Slightly above the baseline 3.

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 — 'Run Python inside Blender on the main thread' — and immediately positions itself as 'the escape hatch' for when structured tools fall short. This clearly differentiates it from the dozens of structured sibling tools by establishing it as the general-purpose fallback rather than a narrow operation.

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 explicit when-to-use and when-not-to-use guidance: 'Use this when the structured tools cannot express what you need' with concrete examples (bmesh surgery, geometry nodes, uncommon operators, bulk edits), and 'Prefer the structured tools when they fit' because they validate inputs and return tidy results. This is textbook routing guidance.

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