  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 have the ratio of metals to hydrogen Z/X =
0.0181, with 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, consistent with the high values of
twenty-five years ago based on 1D LTE spectroscopy. 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 devise a detailed seismic reconstruction technique of the solar
envelope, combining multiple inversions and equations of state 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 are 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.
