Skip to main content
Glama

blender_python_exec

Execute Python scripts synchronously in Blender's context to control scenes, assign materials, and render, with access to bpy and mathutils.

Instructions

Execute a Python script in Blender's context synchronously. Provide either 'code' (inline Python string) or 'script_path' (path to a .py file), not both. The script has access to 'bpy', 'mathutils', and an 'args' dict with your supplied arguments. Set 'result' in the script to return a JSON-serializable value. Returns the result, captured stdout/stderr, and execution duration. Use transport='bridge' for the live Blender add-on session, or transport='headless' to run the script in a separate blender -b process. For long-running tasks like baking, use blender_python_exec_async.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNo
codeNo
transportNobridge
blend_fileNo
script_pathNo
factory_startupNo
timeout_secondsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the execution environment (bpy, mathutils, args dict), the __result__ return convention, and that stdout/stderr and duration are captured. It does not mention permissions, side effects on the open scene, or timeout behavior, which for an arbitrary-code-execution tool would be worth stating.

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?

Front-loaded with the core action, then the input contract, return shape, transport options, and the async alternative in dense, waste-free sentences. No filler.

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

Completeness4/5

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

For a complex 7-parameter code-execution tool with an output schema (so return format need not be restated), the description covers the essentials an agent needs to invoke it. The three undocumented parameters (blend_file, factory_startup, timeout_seconds) are the remaining gap.

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 0% and there are 7 parameters, so the description must compensate and largely does: it explains code, script_path, args, and the transport enum with both mode meanings. blend_file, factory_startup, and timeout_seconds are left undocumented, so it falls short of full coverage.

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 a Python script in Blender's context') plus the synchronous execution scope, which cleanly separates it from blender_python_exec_async named in the same description. An agent can identify the tool's job 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 Guidelines5/5

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

Gives explicit mutual-exclusion guidance ('provide either code or script_path, not both'), explains the transport choice with the meaning of both enum values, and routes long-running work to blender_python_exec_async. When-to-use and alternatives are both covered.

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