Skip to main content
Glama

get_objects

Retrieve all objects from a FreeCAD document to identify available elements for inspection or modification, including a screenshot of the current design.

Instructions

Get all objects in a document. You can use this tool to get the objects in a document to see what you can check or edit.

Args:
    doc_name: The name of the document to get the objects from.

Returns:
    A list of objects in the document and a screenshot of the document.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary MCP tool handler for 'get_objects'. Retrieves all objects from the specified FreeCAD document using the RPC proxy, serializes them to JSON, and returns them with an optional screenshot of the current view.
    @mcp.tool()
    def get_objects(ctx: Context, doc_name: str) -> list[dict[str, Any]]:
        """Get all objects in a document.
        You can use this tool to get the objects in a document to see what you can check or edit.
    
        Args:
            doc_name: The name of the document to get the objects from.
    
        Returns:
            A list of objects in the document and a screenshot of the document.
        """
        freecad = get_freecad_connection()
        try:
            screenshot = freecad.get_active_screenshot()
            response = [
                TextContent(type="text", text=json.dumps(freecad.get_objects(doc_name))),
            ]
            return add_screenshot_if_available(response, screenshot)
        except Exception as e:
            logger.error(f"Failed to get objects: {str(e)}")
            return [
                TextContent(type="text", text=f"Failed to get objects: {str(e)}")
            ]
  • Proxy method in the FreeCADConnection class that forwards the get_objects request to the underlying XML-RPC server.
    def get_objects(self, doc_name: str) -> list[dict[str, Any]]:
        return self.server.get_objects(doc_name)
  • Core implementation in the FreeCAD RPC server. Fetches the document by name and returns a list of serialized objects using the serialize_object helper.
    def get_objects(self, doc_name):
        doc = FreeCAD.getDocument(doc_name)
        if doc:
            return [serialize_object(obj) for obj in doc.Objects]
        else:
            return []

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

No annotations are provided, so the description must disclose behaviors. It correctly states the return values (list of objects and a screenshot), implying a read-only operation. However, it does not explicitly confirm no side effects or mention any permissions needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: two sentences plus an Args/Returns section. Every sentence adds value, and the main purpose is front-loaded. No redundant information.

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 required parameter) and the presence of an output schema, the description is adequate. It covers the purpose, parameter, and returns. However, it could define what 'objects' means or mention that the screenshot is included for context.

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 input schema has 0% description coverage for the 'doc_name' parameter. The description adds a clear explanation: 'The name of the document to get the objects from.' This compensates for the schema gap and adds meaning.

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 the action ('Get all objects') and the resource ('in a document'). It distinguishes from sibling tools like 'get_object' (singular) and other CRUD operations, making the purpose unambiguous.

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

Usage Guidelines4/5

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

It provides a context for use ('to see what you can check or edit') and explicitly mentions the doc_name parameter. However, it does not compare with alternatives like 'get_view' or discuss when not to use it, leaving room for improvement.

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