Skip to main content
Glama
opslon

BlenderMCP

by opslon

execute_blender_code

Execute Python code directly within Blender to automate 3D modeling tasks, modify scenes, or manipulate objects through scripted commands.

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 execute_blender_code tool handler, registered with @mcp.tool(), which executes arbitrary Python code in Blender via a socket connection.
    @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:
            logger.error(f"Error executing code: {str(e)}")
            return f"Error executing code: {str(e)}"
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions executing code 'step-by-step' and 'in Blender,' which gives some context, but it lacks critical details: whether this is a read-only or destructive operation, what permissions are needed, how errors are handled, or any rate limits. For a tool that executes arbitrary code with no annotation coverage, this is a significant gap.

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 appropriately sized and front-loaded: the first sentence states the core purpose, followed by a usage tip and parameter explanation. It avoids unnecessary fluff, though the second sentence could be more tightly integrated. Overall, it's efficient with minimal waste.

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

Completeness2/5

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

Given the tool's complexity (executing arbitrary code in Blender), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't cover behavioral traits like safety, error handling, or output format, which are crucial for such a powerful tool. The description provides basic purpose and parameter info but misses key contextual details.

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?

The description adds meaningful semantics beyond the input schema. The schema has 0% description coverage (only titles), with one parameter 'code' of type string. The description explains that 'code' is 'The Python code to execute,' clarifying its purpose and format. Since there's only one parameter and the description compensates for the low schema coverage, this earns a high score.

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's purpose: 'Execute arbitrary Python code in Blender.' It specifies the verb ('Execute'), resource ('Python code'), and environment ('in Blender'), making it distinct from sibling tools that focus on downloading assets, generating models, or getting status information. However, it doesn't explicitly differentiate from potential similar tools (though none are present in siblings).

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 implied usage guidance: 'Make sure to do it step-by-step by breaking it into smaller chunks.' This suggests a best practice for using the tool, but it doesn't explicitly state when to use this tool versus alternatives (e.g., for code execution vs. other Blender operations) or list any prerequisites. The guidance is helpful but not comprehensive.

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/opslon/blender-mcp-optimized'

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