Fascinating idea! It might help, but we still need to ban assault weapons. They do too much damage too quickly--and it's why the Uvalde police failed to intervene. They didn't want to be obliterated instantaneously.
The mentally ill people who shoot kids in schools also want to publicly air their grievance, so being identified isn't an issue for them. They'd still do what they do, if they can get a weapon in the first place.
AI cannot "quash" a human weakness. It can only inform us more quickly and more accurately if danger exists. But the danger won't go away just because we monitor it.