Skip to main content
Glama

get_object

Retrieve an object from a FreeCAD document to inspect its properties and view a screenshot for analysis or editing.

Instructions

Get an object from a document. You can use this tool to get the properties of an object to see what you can check or edit.

Args: doc_name: The name of the document to get the object from. obj_name: The name of the object to get. Returns: The object and a screenshot of the object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_nameYes
obj_nameYes

Implementation Reference

  • Primary MCP tool handler for 'get_object'. Retrieves object properties via FreeCADConnection proxy, serializes to JSON, adds screenshot if available, and returns as TextContent.
    @mcp.tool() def get_object(ctx: Context, doc_name: str, obj_name: str) -> dict[str, Any]: """Get an object from a document. You can use this tool to get the properties of an object to see what you can check or edit. Args: doc_name: The name of the document to get the object from. obj_name: The name of the object to get. Returns: The object and a screenshot of the object. """ freecad = get_freecad_connection() try: screenshot = freecad.get_active_screenshot() response = [ TextContent(type="text", text=json.dumps(freecad.get_object(doc_name, obj_name))), ] return add_screenshot_if_available(response, screenshot) except Exception as e: logger.error(f"Failed to get object: {str(e)}") return [ TextContent(type="text", text=f"Failed to get object: {str(e)}") ]
  • Helper method in FreeCADConnection class that proxies the get_object RPC call to the XML-RPC server.
    def get_object(self, doc_name: str, obj_name: str) -> dict[str, Any]: return self.server.get_object(doc_name, obj_name)
  • Backend RPC server implementation of get_object. Fetches the FreeCAD DocumentObject by name and serializes it using serialize_object.
    def get_object(self, doc_name, obj_name): doc = FreeCAD.getDocument(doc_name) if doc: return serialize_object(doc.getObject(obj_name)) else: return None
  • Serialization helper function used to convert FreeCAD objects to JSON-serializable dicts. (Full function spans multiple lines including recursive serialization.)
    def serialize_object(obj): if isinstance(obj, list): return [serialize_object(item) for item in obj]

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