Skip to main content
Glama

execute_blender_code

Run Python code directly in Blender to automate 3D modeling tasks, create objects, and manipulate scenes through script execution.

Instructions

Execute arbitrary Python code in Blender. Make sure to do it step-by-step by breaking it into smaller chunks.

Parameters:

  • code: The Python code to execute

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Implementation Reference

  • The tool handler for "execute_blender_code" which uses a blender connection to execute provided code.
    @telemetry_tool("execute_blender_code")
    @mcp.tool()
    def execute_blender_code(ctx: Context, code: str) -> str:
        """
        Execute arbitrary Python code in Blender. Make sure to do it step-by-step by breaking it into smaller chunks.
    
        Parameters:
        - code: The Python code to execute
        """
        try:
            # Get the global connection
            blender = get_blender_connection()
            result = blender.send_command("execute_code", {"code": code})
            return f"Code executed successfully: {result.get('result', '')}"
        except Exception as e:
Behavior3/5

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

With no annotations provided, the description carries the full disclosure burden. The chunking advice hints at stability/timeout concerns, but the description fails to explicitly state that execution modifies Blender's state, can crash the application, or detail what APIs (e.g., bpy) are available to the executed code.

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?

The description is front-loaded with the core purpose, followed by critical usage advice, then parameter documentation. It is appropriately sized for the tool's complexity, though the parameter section is formatted as inline text rather than utilizing structured schema descriptions.

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

Completeness3/5

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

Given this is a high-risk code execution tool with no output schema and no annotations, the description is minimally viable but incomplete. It should disclose error handling behavior, execution environment constraints, and the namespace/modules available to the executed code to reach completeness for this complexity level.

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?

With 0% schema description coverage, the description compensates adequately by specifying the 'code' parameter contains 'Python code to execute,' adding critical language context missing from the generic string schema. It stops short of detailing syntax requirements, available modules, or execution scope.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool executes arbitrary Python code in Blender, using a specific verb and resource. While it distinguishes well from asset-focused sibling tools like 'download_polyhaven_asset' or 'import_generated_asset', it could be elevated to a 5 by explicitly contrasting this low-level code execution with the higher-level scene manipulation alternatives.

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?

The description provides specific procedural guidance ('break it into smaller chunks'), implying the tool prefers incremental execution. However, it lacks explicit 'when to use' criteria comparing code execution against individual scene manipulation tools, and provides no 'when not to use' constraints or prerequisites.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/omniconnexsynapse/blender-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server