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

delete_object

Remove an object from a FreeCAD document by specifying the document and object names, and confirm deletion with a success message and screenshot.

Instructions

Delete an object in FreeCAD.

Args:
    doc_name: The name of the document to delete the object from.
    obj_name: The name of the object to delete.

Returns:
    A message indicating the success or failure of the object deletion and a screenshot of the object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_nameYes
obj_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for delete_object: calls FreeCAD proxy, handles response, adds screenshot feedback.
    @mcp.tool()
    def delete_object(ctx: Context, doc_name: str, obj_name: str) -> list[TextContent | ImageContent]:
        """Delete an object in FreeCAD.
    
        Args:
            doc_name: The name of the document to delete the object from.
            obj_name: The name of the object to delete.
    
        Returns:
            A message indicating the success or failure of the object deletion and a screenshot of the object.
        """
        freecad = get_freecad_connection()
        try:
            res = freecad.delete_object(doc_name, obj_name)
            screenshot = freecad.get_active_screenshot()
            
            if res["success"]:
                response = [
                    TextContent(type="text", text=f"Object '{res['object_name']}' deleted successfully"),
                ]
                return add_screenshot_if_available(response, screenshot)
            else:
                response = [
                    TextContent(type="text", text=f"Failed to delete object: {res['error']}"),
                ]
                return add_screenshot_if_available(response, screenshot)
        except Exception as e:
            logger.error(f"Failed to delete object: {str(e)}")
            return [
                TextContent(type="text", text=f"Failed to delete object: {str(e)}")
            ]
  • FreeCADConnection proxy method that forwards delete_object call to RPC server.
    def delete_object(self, doc_name: str, obj_name: str) -> dict[str, Any]:
        return self.server.delete_object(doc_name, obj_name)
  • RPC server endpoint for delete_object: queues GUI task and returns success/error.
    def delete_object(self, doc_name: str, obj_name: str):
        rpc_request_queue.put(lambda: self._delete_object_gui(doc_name, obj_name))
        res = rpc_response_queue.get()
        if res is True:
            return {"success": True, "object_name": obj_name}
        else:
            return {"success": False, "error": res}
  • Core implementation: performs doc.removeObject(obj_name) in GUI thread.
    def _delete_object_gui(self, doc_name: str, obj_name: str):
        doc = FreeCAD.getDocument(doc_name)
        if not doc:
            FreeCAD.Console.PrintError(f"Document '{doc_name}' not found.\n")
            return f"Document '{doc_name}' not found.\n"
    
        try:
            doc.removeObject(obj_name)
            doc.recompute()
            FreeCAD.Console.PrintMessage(f"Object '{obj_name}' deleted via RPC.\n")
            return True
        except Exception as e:
            return str(e)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool deletes an object, implying a destructive mutation, but doesn't mention permissions required, whether deletion is reversible, side effects (e.g., on dependent objects), or error handling. The return message and screenshot are noted, but behavioral traits like rate limits or confirmation prompts are absent.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core purpose. The Args and Returns sections are structured for clarity, though the return statement could be more concise. Every sentence adds value, but minor verbosity in the return description prevents a perfect score.

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's complexity (destructive operation with 2 parameters) and no annotations, the description is moderately complete. It covers purpose, parameters, and returns, and an output schema exists, so return values needn't be detailed. However, it lacks critical context like safety warnings, prerequisites, or error scenarios, making it adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that 'doc_name' is 'The name of the document to delete the object from' and 'obj_name' is 'The name of the object to delete', clarifying their roles beyond schema titles. However, it doesn't provide format details, constraints, or examples, leaving gaps in parameter understanding.

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 ('Delete') and resource ('an object in FreeCAD'), making the purpose unambiguous. It distinguishes from siblings like 'create_object' and 'edit_object' by specifying deletion. However, it doesn't explicitly differentiate from other destructive operations or mention what type of object is being deleted, keeping it from a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., the object must exist), when not to use it (e.g., for read-only operations), or refer to sibling tools like 'get_object' for verification. Usage is implied only through the tool name and description.

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

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