I don’t know about the constitutionality of such things, but it is certainly done.
Shortly after the Columbine hysteria, a senior at the high school I was then attending in Santa Rosa, CA made such a threatening remark. I believe it was along the lines of: “I’m going to buy a gun and shoot someone soon.” I don’t think that a specific Mr. Someone was mentioned. However, my memory on exact details may be sketchy. The remark was not made at school.
Not only did they arrest him, but they were able to search his home. I don’t know if they got a search warrant or if his parents allowed the police in. They found that he did not have a gun (although he had recently turned 18, and could have purchased one). They also found he had a collection of knives, some legal, some illegal, but all in display cases.
He was expelled from school and I don’t know if he was tried for a crime. All the while he said that it was nothing but a joke in bad taste.