Skip to main content
Glama

create_object

Add 3D objects to Blender scenes by specifying type, location, rotation, and scale parameters for scene composition.

Instructions

Create a new object in the Blender scene.

Parameters:
- type: Object type (CUBE, SPHERE, CYLINDER, PLANE, CONE, TORUS, EMPTY, CAMERA, LIGHT)
- name: Optional name for the object
- location: Optional [x, y, z] location coordinates
- rotation: Optional [x, y, z] rotation in radians
- scale: Optional [x, y, z] scale factors

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoCUBE
nameNo
locationNo
rotationNo
scaleNo

Implementation Reference

  • The main handler function for the 'create_object' MCP tool. It is decorated with @mcp.tool() for automatic registration. The function constructs parameters from inputs, sends a 'create_object' command to the Blender addon via socket, and returns a success message with the created object's name.
    @mcp.tool()
    def create_object(
        ctx: Context,
        type: str = "CUBE",
        name: str = None,
        location: List[float] = None,
        rotation: List[float] = None,
        scale: List[float] = None,
    ) -> str:
        """
        Create a new object in the Blender scene.
    
        Parameters:
        - type: Object type (CUBE, SPHERE, CYLINDER, PLANE, CONE, TORUS, EMPTY, CAMERA, LIGHT)
        - name: Optional name for the object
        - location: Optional [x, y, z] location coordinates
        - rotation: Optional [x, y, z] rotation in radians
        - scale: Optional [x, y, z] scale factors
        """
        try:
            # Get the global connection
            blender = get_blender_connection()
    
            # Set default values for missing parameters
            loc = location or [0, 0, 0]
            rot = rotation or [0, 0, 0]
            sc = scale or [1, 1, 1]
    
            params = {"type": type, "location": loc, "rotation": rot, "scale": sc}
    
            if name:
                params["name"] = name
    
            result = blender.send_command("create_object", params)
            return f"Created {type} object: {result['name']}"
        except Exception as e:
            logger.error(f"Error creating object: {str(e)}")
            return f"Error creating object: {str(e)}"
  • The docstring provides detailed input schema/parameter descriptions for the create_object tool, specifying types, defaults, and valid values (e.g., primitive types).
    """
    Create a new object in the Blender scene.
    
    Parameters:
    - type: Object type (CUBE, SPHERE, CYLINDER, PLANE, CONE, TORUS, EMPTY, CAMERA, LIGHT)
    - name: Optional name for the object
    - location: Optional [x, y, z] location coordinates
    - rotation: Optional [x, y, z] rotation in radians
    - scale: Optional [x, y, z] scale factors
    """
  • src/server.py:318-318 (registration)
    The @mcp.tool() decorator registers the create_object function as an MCP tool.
    @mcp.tool()
  • Reference to create_object in the asset_creation_strategy prompt, guiding when to use it.
    - create_object() for basic primitives (CUBE, SPHERE, CYLINDER, etc.)

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/VAST-AI-Research/tripo-mcp'

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