Skip to main content
Glama

create_document

Create a new FreeCAD document by specifying a name to start 3D modeling projects.

Instructions

Create a new document in FreeCAD.

Args:
    name: The name of the document to create.

Returns:
    A message indicating the success or failure of the document creation.

Examples:
    If you want to create a document named "MyDocument", you can use the following data.
    ```json
    {
        "name": "MyDocument"
    }
    ```

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Primary MCP tool handler for 'create_document'. Decorated with @mcp.tool() for registration. Calls FreeCADConnection to create document via RPC and returns success/error text content.
    @mcp.tool()
    def create_document(ctx: Context, name: str) -> list[TextContent]:
        """Create a new document in FreeCAD.
    
        Args:
            name: The name of the document to create.
    
        Returns:
            A message indicating the success or failure of the document creation.
    
        Examples:
            If you want to create a document named "MyDocument", you can use the following data.
            ```json
            {
                "name": "MyDocument"
            }
            ```
        """
        freecad = get_freecad_connection()
        try:
            res = freecad.create_document(name)
            if res["success"]:
                return [
                    TextContent(type="text", text=f"Document '{res['document_name']}' created successfully")
                ]
            else:
                return [
                    TextContent(type="text", text=f"Failed to create document: {res['error']}")
                ]
        except Exception as e:
            logger.error(f"Failed to create document: {str(e)}")
            return [
                TextContent(type="text", text=f"Failed to create document: {str(e)}")
            ]
  • Helper proxy method in FreeCADConnection class that forwards create_document call to the XML-RPC server.
    def create_document(self, name: str) -> dict[str, Any]:
        return self.server.create_document(name)
  • Proxy method in the FreeCADConnection class used by the MCP handler to invoke the RPC call.
    def create_document(self, name: str) -> dict[str, Any]:
        return self.server.create_document(name)
  • Core GUI-thread-safe implementation that creates the new FreeCAD document using FreeCAD.newDocument().
    def _create_document_gui(self, name):
        doc = FreeCAD.newDocument(name)
        doc.recompute()
        FreeCAD.Console.PrintMessage(f"Document '{name}' created via RPC.\n")
        return True
  • RPC server method that queues the document creation task on the GUI thread and returns success/error dict.
    def create_document(self, name="New_Document"):
        rpc_request_queue.put(lambda: self._create_document_gui(name))
        res = rpc_response_queue.get()
        if res is True:
            return {"success": True, "document_name": name}
        else:
            return {"success": False, "error": res}
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions the tool creates a document and returns success/failure messages, it lacks critical details like permission requirements, whether the document becomes active/selected, what happens if a document with the same name exists, or any rate limits. The description provides minimal behavioral context beyond the basic operation.

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

Conciseness3/5

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

The description is reasonably structured with clear sections (Args, Returns, Examples), but includes some redundancy. The example JSON could be more concise, and the 'Returns' section could be integrated more efficiently. While not excessively verbose, it doesn't achieve the efficiency of the highest-scoring examples.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which should document return values) and only 1 parameter, the description covers the basics adequately. However, for a creation tool with no annotations, it should provide more behavioral context about what 'creating a document' entails in FreeCAD's environment and how it relates to sibling tools.

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?

With only 1 parameter and 0% schema description coverage, the description effectively compensates by explaining that 'name' refers to 'The name of the document to create'. It provides a concrete example showing how to use the parameter, adding meaningful context beyond what the bare schema provides.

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 action ('Create a new document') and resource ('in FreeCAD'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'create_object', which might create confusion about when to use each.

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 about when to use this tool versus alternatives like 'create_object'. The description mentions the tool's basic function but offers no context about prerequisites, when it's appropriate, or what distinguishes it from similar tools in the server.

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

Install Server

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

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