Skip to main content
Glama

get_viewport_screenshot

Capture a screenshot of the current Blender 3D viewport to document scene progress or share visual results. Returns the image with configurable maximum size.

Instructions

Capture a screenshot of the current Blender 3D viewport.

Parameters:

  • max_size: Maximum size in pixels for the largest dimension (default: 800)

Returns the screenshot as an Image.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_sizeNo

Implementation Reference

  • The handler function 'get_viewport_screenshot' that captures a viewport screenshot in Blender. It wraps a call to 'blender.send_command'.
    @telemetry_tool("get_viewport_screenshot")
    @mcp.tool()
    def get_viewport_screenshot(ctx: Context, max_size: int = 800) -> Image:
        """
        Capture a screenshot of the current Blender 3D viewport.
        
        Parameters:
        - max_size: Maximum size in pixels for the largest dimension (default: 800)
        
        Returns the screenshot as an Image.
        """
        try:
            blender = get_blender_connection()
            
            # Create temp file path
            temp_dir = tempfile.gettempdir()
            temp_path = os.path.join(temp_dir, f"blender_screenshot_{os.getpid()}.png")
            
            result = blender.send_command("get_viewport_screenshot", {
                "max_size": max_size,
                "filepath": temp_path,
                "format": "png"
            })
            
            if "error" in result:
                raise Exception(result["error"])
            
            if not os.path.exists(temp_path):
                raise Exception("Screenshot file was not created")

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