Skip to main content
Glama

get_view

Capture screenshots of 3D CAD designs from specific viewpoints like Isometric, Front, Top, and other orientations for documentation and review purposes.

Instructions

Get a screenshot of the active view.

Args:
    view_name: The name of the view to get the screenshot of.
    The following views are available:
    - "Isometric"
    - "Front"
    - "Top"
    - "Right"
    - "Back"
    - "Left"
    - "Bottom"
    - "Dimetric"
    - "Trimetric"

Returns:
    A screenshot of the active view.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
view_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler for the 'get_view' tool. It is registered via the @mcp.tool() decorator and implements the logic to retrieve a screenshot from the specified FreeCAD view by calling the helper method.
    @mcp.tool()
    def get_view(ctx: Context, view_name: Literal["Isometric", "Front", "Top", "Right", "Back", "Left", "Bottom", "Dimetric", "Trimetric"]) -> list[ImageContent | TextContent]:
        """Get a screenshot of the active view.
    
        Args:
            view_name: The name of the view to get the screenshot of.
            The following views are available:
            - "Isometric"
            - "Front"
            - "Top"
            - "Right"
            - "Back"
            - "Left"
            - "Bottom"
            - "Dimetric"
            - "Trimetric"
    
        Returns:
            A screenshot of the active view.
        """
        freecad = get_freecad_connection()
        screenshot = freecad.get_active_screenshot(view_name)
        
        if screenshot is not None:
            return [ImageContent(type="image", data=screenshot, mimeType="image/png")]
        else:
            return [TextContent(type="text", text="Cannot get screenshot in the current view type (such as TechDraw or Spreadsheet)")]
  • Supporting helper method in the FreeCADConnection class used by get_view to safely obtain a screenshot, including view compatibility checks.
        def get_active_screenshot(self, view_name: str = "Isometric") -> str | None:
            try:
                # Check if we're in a view that supports screenshots
                result = self.server.execute_code("""
    import FreeCAD
    import FreeCADGui
    
    if FreeCAD.Gui.ActiveDocument and FreeCAD.Gui.ActiveDocument.ActiveView:
        view_type = type(FreeCAD.Gui.ActiveDocument.ActiveView).__name__
        
        # These view types don't support screenshots
        unsupported_views = ['SpreadsheetGui::SheetView', 'DrawingGui::DrawingView', 'TechDrawGui::MDIViewPage']
        
        if view_type in unsupported_views or not hasattr(FreeCAD.Gui.ActiveDocument.ActiveView, 'saveImage'):
            print("Current view does not support screenshots")
            False
        else:
            print(f"Current view supports screenshots: {view_type}")
            True
    else:
        print("No active view")
        False
    """)
    
                # If the view doesn't support screenshots, return None
                if not result.get("success", False) or "Current view does not support screenshots" in result.get("message", ""):
                    logger.info("Screenshot unavailable in current view (likely Spreadsheet or TechDraw view)")
                    return None
    
                # Otherwise, try to get the screenshot
                return self.server.get_active_screenshot(view_name)
            except Exception as e:
                # Log the error but return None instead of raising an exception
                logger.error(f"Error getting screenshot: {e}")
                return None

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.7/5.0
Behavior2/5

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

With no annotations, the description carries the behavioral disclosure burden. It only states 'Get a screenshot' but does not explain how the screenshot is returned (image data, file path, base64), whether the view can be changed, or if the operation is idempotent. The return value is vague.

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 front-loaded with the purpose. The args and returns sections are structured. However, listing all enum values is somewhat redundant with the schema, but not excessive.

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?

The tool has a simple parameter and an output schema (likely defining the screenshot format), but the description omits details about the output format and any prerequisites. It is insufficient for an agent to fully understand the tool's usage without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description repeats the enum list from the schema without adding meaning (e.g., explaining what each view orientation is, like 'Isometric' vs 'Front'). Since schema description coverage is 0%, the description could have compensated by describing the views, but it did not.

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 gets a screenshot of the active view and lists the available views. It distinguishes itself from sibling tools like get_object or get_objects by specifying it captures a visual screenshot rather than data objects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives (e.g., when a screenshot is needed vs. getting object data). It does not mention prerequisites like whether a view must be active or what constitutes the 'active view.'

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