Every Ancient Dragon has Detect as a Legendary Action:
Detect. The dragon makes a Wisdom (Perception) check.
Unless I'm missing something, this seems to be a worthlessly ambiguous action. PHB 174 (under "Ability Checks") reads:
The DM calls for an ability check whenever a character or monster attempts an action (other than an attack) that has a chance of failure. When the outcome is uncertain, the dice determine the results.
In other words, after an action is declared, if it can fail, dice must be rolled. But the Dragon isn't attempting a fallable action; it's just rolling perception dice with no means or ends, with no attempted action attached to them. It's skipping the part where it attempts an action and it's going straight to the dice rolls.
Can the dragon attempt anything that the GM could justify as a perception check? Or does it have a more specific purpose, such as locating a hiding character or identifying an illusion? If so, why is it termed so ambiguously? If not, what does the Detect action actually do?