Skip to main content
Glama

assets-delete

Remove unwanted assets from Unity projects by specifying their paths. Automatically refreshes the Asset Database after deletion to maintain project integrity.

Instructions

Delete the assets at paths from the project. Does AssetDatabase.Refresh() at the end. Use 'assets-find' tool to find assets before deleting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesArray of asset paths to delete. Example: ["Assets/Materials/Mat.mat"]

Implementation Reference

  • The call_tool function in mcp_server.py handles the execution of any Unity Bridge tool, including 'assets-delete', by writing a JSON command file to a file IPC directory and waiting for a response file.
    def call_tool(name, arguments):
        """Execute a Unity Bridge tool via file IPC. Returns MCP content result."""
        bridge_dir = get_bridge_dir()
        commands_dir = os.path.join(bridge_dir, "commands")
        results_dir = os.path.join(bridge_dir, "results")
    
        # Heartbeat check
        err = check_heartbeat(bridge_dir)
        if err:
            return True, err
    
        # Write command
        command_id = f"{int(time.time())}-{uuid.uuid4().hex[:8]}"
        command = {"id": command_id, "tool": name, "params": arguments or {}}
    
        os.makedirs(commands_dir, exist_ok=True)
        os.makedirs(results_dir, exist_ok=True)
    
        command_file = os.path.join(commands_dir, f"{command_id}.json")
        write_atomic(command_file, json.dumps(command))
    
        # Poll for result
        result_file = os.path.join(results_dir, f"{command_id}.json")
        elapsed = 0.0
    
        while not os.path.exists(result_file):
            time.sleep(IPC_POLL_INTERVAL)
            elapsed += IPC_POLL_INTERVAL
            if elapsed >= IPC_TIMEOUT:
                try:
                    os.remove(command_file)
                except OSError:
                    pass
                return True, f"Timeout after {IPC_TIMEOUT}s waiting for Unity (tool: {name})"
    
        # Read result
        try:
            with open(result_file, "r", encoding="utf-8") as f:
                result = json.load(f)
        finally:
            try:
                os.remove(result_file)
            except OSError:
                pass
    
        is_error = result.get("status") != "success"
        message = result.get("message", "")
        return is_error, message

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/butterlatte-zhang/unity-ai-bridge'

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