The sunroof on my 2016 Mercedes GLE will nnot fully close or open
The sunroof runs on little tracks that run under the roofline. Check and see if there's something blocking them. That's fairly simple; open the roof as far as it goes right now, then shine a flashlight in the tracks to see if there's an obstacle. It could also be a wiring issue that needs to be looked at.
Try cleaning/lubrication/initialization and visually check if it has any piece of plastic that is stopping it to close. When you try to close or open , if you don't hear any noise , your sunroof motor may need to replace. Test sunroof wires, switch using multimete.