The spell Magnificent Mansion states the following (emphasis mine) :
You conjure an extradimensional dwelling in range that lasts for the duration. You choose where its one entrance is located. The entrance shimmers faintly and is 5 feet wide and 10 feet tall. You and any creature you designate when you cast the spell can enter the extradimensional dwelling as long as the portal remains open. You can open or close the portal if you are within 30 feet of it. While closed, the portal is invisible.
The issue here is whether or not the presence of the portal can be detected while invisible, and if the nature of the spell can then be identified (or at the very least, identify that it manifests as a portal).
I first thought of Detect Magic, but the spell actually states (emphasis mine) :
For the duration, you sense the presence of magic within 30 feet of you. If you sense magic in this way, you can use your action to see a faint aura around any visible creature or object in the area that bears magic, and you learn its school of magic, if any.
As far as I understand it, this means that using Detect Magic, you would be able to sense there is some kind of magic around the portal's area, but you wouldn't be able to identify it further because it isn't visible (is a portal even an "object" in the first place, anyway?).
Is there no other way to detect the portal's presence while it is closed, or even do better than Detect Magic and identify the nature of the spell?
For a little bit of context, a player is thinking about very convoluted ways of creating an on-command trap, and using a Magnificent Mansion came up. Because of that, they've been asking whether or not it could be detected before it is tripped, and I haven't been able to find a solid answer to the question myself. I might cover the player's full plan in more depth in another question, if the need arises.