Context : The stellar metallicity and its gradient pose constraints to the formation and evolution of galaxies . Aims : This is a study of the metallicity gradient of the LMC , SMC and M33 galaxies derived from their asymptotic giant branch ( AGB ) stars . Methods : The [ Fe/H ] abundance was derived from the ratio between C- and M-type AGB stars and its variation analysed as a function of galactocentric distance . Galaxy structure parameters were adopted from the literature . Results : The metallicity of the LMC decreases linearly as -0.047 \pm 0.003 dex kpc ^ { -1 } out to \sim 8 kpc from the centre . In the SMC , [ Fe/H ] has a constant value of \sim - 1.25 \pm 0.01 dex up to \sim 12 kpc . The gradient of the M33 disc , until \sim 9 kpc , is -0.078 \pm 0.003 dex kpc ^ { -1 } while an outer disc/halo , out to \sim 25 kpc , has [ Fe/H ] \sim - 1.7 dex . Conclusions : The metallicity of the LMC , as traced by different populations , bears the signature of two major star forming episodes : the first one constituting a thick disc/halo population and the second one a thin disc and bar due to a close encounter with the MW and SMC . The [ Fe/H ] of the recent episode supports an LMC origin for the Stream . The metallicity of the SMC supports star formation , \sim 3 Gyr ago , as triggered by LMC interaction and sustained by the bar in the outer region of the galaxy . The SMC [ Fe/H ] agrees with the present-day abundance in the Bridge and shows no significant gradient . The metallicity of M33 supports an “ inside-out ” disc formation via accretion of metal poor gas from the interstellar medium .