Magnesium is available in many foods[nuts are quite rich in it, especially pumpkin seeds] and it is important for general health and for the brain. Low magnesium intake can cause many problems but muscle spasms and anxiety are the most well-known effects the average person knows about. Taking magnesium supplements have a quite proven effect if there is a deficiency
If there is no magnesium lack [hard to examine] then extra magnesium will not help.
Too much magnesium for a certain individual may cause too loose stools or diarrhoea
A high intake of magnesium in food alone will not cause these side effects.
For anyone with anxiety [also for a condition which in itself is innocent -as far as I know-called mitral valve prolapse magnesium may help
For anxiety extra magnesium should be tried before everything else, it can take a while before the effect becomes visible/’feelable.
There are several supplements available[magnesium citrate, gluconate etc]. Magnesium oxide is not a good choice
The dose may variate from 200 to 400 mg [elemental] magnesium
People who easily get a magnesium shortage are:
-Those taking PPI’s[Omepradex etc]: can be VERY SERIOUS even life-threatening.
-heavy sport/swearing[ much mineral loss in general]
-poor diet
-taking diuretics [hydrochlorothiazide etc]for hypertension

Take magnesium as a supplement only if your kidney function is ok!
These are in short -maybe- the most important points about magnesium.