Skip to main content
Glama

render_preview

Generate a base64-encoded preview image from the current Cinema 4D view, with optional width, height, and frame parameters for scene visualization.

Instructions

Render the current view and return a base64-encoded preview image.

Args:
    width: Optional preview width in pixels
    height: Optional preview height in pixels
    frame: Optional frame number to render

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
widthNo
heightNo
frameNo

Implementation Reference

  • The handler function that implements the render_preview tool logic.
    async def render_preview(
        width: Optional[int] = None,
        height: Optional[int] = None,
        frame: Optional[int] = None,
        ctx: Context = None,
    ) -> str:
        """
        Render the current view and return a base64-encoded preview image.
    
        Args:
            width: Optional preview width in pixels
            height: Optional preview height in pixels
            frame: Optional frame number to render
        """
        async with c4d_connection_context() as connection:
            if not connection.connected:
                return "❌ Not connected to Cinema 4D"
    
            # Prepare command
            command = {"command": "render_preview"}
    
            if width:
                command["width"] = width
            if height:
                command["height"] = height
            if frame is not None:
                command["frame"] = frame
    
            # Set longer timeout for rendering
            logger.info(f"Sending render_preview command with parameters: {command}")
    
            # Send command to Cinema 4D
            response = send_to_c4d(connection, command)
    
            if "error" in response:
                return f"❌ Error: {response['error']}"
    
            return format_c4d_response(response, "render_preview")
  • The decorator that registers render_preview as an MCP tool.
    @mcp.tool()

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/ttiimmaacc/cinema4d-mcp'

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