Context. The metal mass fraction of the Sun Z is a key constraint in solar modelling, but its value is still under debate. The standard solar chemical composition of the late 2000s has the ratio of metals to hydrogen as Z/X = 0.0181, and there was a small increase to 0.0187 in 2021, as inferred from 3D non-LTE spectroscopy. However, more recent work on a horizontally and temporally averaged ⟨3D⟩ model claim Z/X = 0.0225, which is consistent with the high values based on 1D LTE spectroscopy from 25 years ago. Aims. We aim to determine a precise and robust value of the solar metal mass fraction from helioseismic inversions, thus providing independent constraints from spectroscopic methods. Methods. We devised a detailed seismic reconstruction technique of the solar envelope, combining multiple inversions and equations of state in order to accurately and precisely determine the metal mass fraction value. Results. We show that a low value of the solar metal mass fraction corresponding to Z/X = 0.0187 is favoured by helioseismic constraints and that a higher metal mass fraction corresponding to Z/X = 0.0225 is strongly rejected by helioseismic data. Conclusions. We conclude that direct measurement of the metal mass fraction in the solar envelope favours a low metallicity, in line with the 3D non-LTE spectroscopic determination of 2021. A high metal mass fraction, as measured using a ⟨3D⟩ model in 2022, is disfavoured by helioseismology for all modern equations of state used to model the solar convective envelope.