They have blood tests for both (serum or RBC):

The Magnesium RBC Test measures magnesium inside red blood cells, providing a more accurate assessment of magnesium status than serum tests.