aguadalte
The real problem is how to avoid having a pilot with severe mental health issues operating an aircraft. By the time they are sat in the seat it is too late...
Are you suggesting a sanity cross check pre-flight?
Paramedics establish if a patient is mentally altered at a scene by confirming they are 4x4. Meaning you ask 4 basic questions and verify 4 correct answers e.g. name, todays date, who is the President, do you know where you are. Any hesitation or spurious answer helps assess the individuals state of mind.
IMHO this is flawed and far better to assume that one flight crew might become mentally altered at any time i.e. mid-flight. So you should have at least 2 people behind the security door at all times. Maybe consider putting a bathroom inside the secure cockpit area. Allowing only one person up front is clearly a single point of failure in an environment engineered for redundancy.