This is not a realistic solution, for a variety of reasons: only SSRIs, or SNRIs too? What about TCAs and other antidepressants? What about all the people that are taking these meds for neuropathic pain and don't have a mental illness?
The idea of healthcare providers clearing people to purchase guns also is not a realistic solution. The healthcare system, especially the mental healthcare system, is already overwhelmed with several month waiting periods. Adding this would further break the mental health system, and there is no evidence on how to effectively approach clearing people for guns.
As has been said many times, other countries have figured this out. It isn't complicated - gun access needs to be decreased. This includes raising the federal minimum age to 21, universal background checks, magazine capacity limits, assault weapons ban, red flag laws, and outlaw ghost guns.