It has already been done....
Imagine expanding the disqualifiers to include those who'd simply been adjudicated mentally defective by a school official, a boss, or their peers. Such a thing would be a blatant denial of due process.
Keep expanding the definition of "mentally defective" far enough,.....
In the Soviet Union, people who did anything but toe the party line were determined to be "mentally defective" and sent to "treatment" and "re-education camps". They weren't responsible, the poor souls, they were "mentally defective"....
In this country today, you can be as "mentally defective" as you wish, and unless and until you are convicted of a crime (punishable by 1 year or more) OR are adjudicated (by a court) of being mentally incompetent, you can buy a gun from a licensed dealer. No law can prevent, only punish after the crime has been committed. And until you are found guilty in court, you must be considered innocent, under our system. That is why you always hear the media use the word alleged, until after a conviction. The guy caught red handed, in front of dozens of witnesses, and he will still be called "alleged shooter" until after the trial is over. Then he will be called "convicted".
As has been already noted, the "15 minutes of fame" that the media will give the shooter is often all the motive needed to send a borderline individual over the edge from fantasy to actual action. They know that they will be famous, at least for a brief time. And for some, that is enough.
The problem is that while obvious after the fact that the shooter was not stable enough to be allowed a weapon, before the fact there is no reason to deny him one. And yet, many people will think that there should have been one. They will seize on the smallest detail, anything even remotely outside the "norm" and say that we should have seen this coming, and prevented it.
Yet there are laws in this nation that prevent just that. Its called privacy. Until and unless a certain specific set of conditions are met (such as verbal threats of violence, etc..) even professional mental health personnel are legally prohibited from reporting or turning in someone that they feel is unstable, because it would be a violation of that individual's right to privacy.
Patrick Purdy, the shooter in that Stockton CA schoolyard waaaay back in the early 80s (the incident that sparked the still thriving "assault weapon" hysteria) was receiving monthly checks from Social Security, because of his unstable mental condition, which prevented him from holding a job. Yet, he bought 3 handguns in California, legally, passing the background check and waiting period each time. The SS administration was prevented, by law, from giving the information about his mental condition to the state.
Other mass shooters over the last couple decades have had similar backgrounds. Not stable, but not clearly unstable enough to trip the legal trigger preventing them from legally acquiring firearms.
And those legal requirements are there for good reason. Even though they fail to prevent horrific tragedies like this one, they do prevent, virtually on a daily basis, the system from abusing and trampling
the rights of people who have done nothing wrong!
This is the price of liberty. It is a steep one, and not one a lot of the world is prepared to pay. Much of the world takes the other approach, being highly restrictive about firearms ownership, if not completely resticted outside of military and police. And you know what? They get the mass killings anyway.
Because people willing to break the ultimate moral law are not deterred by lesser laws, either.