Skip to main content
Glama

get_objects

Retrieve all objects and a screenshot from a FreeCAD document to identify and manage 3D elements for editing or inspection.

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

Implementation Reference

  • The main handler function for the MCP 'get_objects' tool. It connects to FreeCAD, retrieves the objects for the given document, serializes them to JSON, adds an optional screenshot, and returns the response.
    @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)}") ]
  • Helper method in FreeCADConnection class that proxies the get_objects RPC call to the FreeCAD addon 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 that fetches the document objects and serializes them using serialize_object.
    def get_objects(self, doc_name): doc = FreeCAD.getDocument(doc_name) if doc: return [serialize_object(obj) for obj in doc.Objects] else: return []

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/heok-yongssun/freecad-mcp'

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