Skip to main content
Glama
neka-nat
by neka-nat

get_objects

Retrieve all objects from a specified FreeCAD document to review or modify. Returns a list of objects and a document screenshot.

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

  • MCP tool handler implementation for 'get_objects'. Retrieves all objects from the specified FreeCAD document via RPC proxy, serializes to JSON, and optionally includes a screenshot.
    @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 FreeCADConnection class that forwards the get_objects call 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 FreeCAD document and serializes all its objects 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 []
  • FastMCP decorator that registers the get_objects function as an MCP tool, inferring schema from signature and docstring.
    @mcp.tool()

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/neka-nat/freecad-mcp'

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