Skip to main content
Glama

get_viewport_screenshot

Capture screenshots of the Blender 3D viewport to document your scene, share progress, or create reference images for AI-assisted modeling workflows.

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 main handler function for the 'get_viewport_screenshot' tool. It connects to Blender, sends a command to capture the viewport screenshot to a temporary file, reads the image bytes, and returns an MCP Image object.
    @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")
            
            # Read the file
            with open(temp_path, 'rb') as f:
                image_bytes = f.read()
            
            # Delete the temp file
            os.remove(temp_path)
            
            return Image(data=image_bytes, format="png")
            
        except Exception as e:
            logger.error(f"Error capturing screenshot: {str(e)}")
            raise Exception(f"Screenshot failed: {str(e)}")
  • The @mcp.tool() decorator registers the get_viewport_screenshot function as an MCP tool.
    @mcp.tool()

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.0.0
    • addedInput schema / title
      Added value: +"get_viewport_screenshotArguments"
  2. First observed

TDQS

A4.1/5.0
Behavior4/5

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

The description mentions that it returns an Image and defines the max_size parameter. No annotations are provided, so the description adequately covers the read-only nature and output format. It does not disclose potential errors or viewport requirements, but this is acceptable for a straightforward capture tool.

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 short and to the point, front-loading the main purpose and including parameter details. Could be slightly more structured, but it is efficient and clear.

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

Completeness4/5

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

Given the tool's simplicity (one optional parameter, no output schema), the description covers the essentials: what it does, its parameter meaning, and return type. Missing details like resolution bounds or behavior on failure, but not critical for a basic screenshot tool.

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 schema provides only type and default for max_size; the description adds 'Maximum size in pixels for the largest dimension', which clarifies its purpose. With 0% schema coverage, the description effectively compensates.

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

Purpose5/5

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

The description clearly states 'Capture a screenshot of the current Blender 3D viewport', specifying the verb 'capture' and the resource 'screenshot of viewport'. It distinguishes well from sibling tools that deal with scenes, objects, or scripts.

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?

No explicit guidance on when to use or avoid this tool. The description is self-contained but lacks context about alternatives or prerequisites. However, the tool is simple and its purpose is obvious.

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