Bifunctional enzyme that catalyzes the second and fourth steps of tryptophan biosynthetic pathway. The second step is catalyzed by the anthranilate phosphoribosyltransferase, coded by the TrpD domain and the fourth step is catalyzed by indole-3-glycerol phosphate synthase, coded by the TrpC domain (By similarity). 1-(2-carboxyphenylamino)-1-deoxy-D-ribulose 5-phosphate + H(+) = (1S,2R)-1-C-(indol-3-yl)glycerol 3-phosphate + CO2 + H2O diphosphate + N-(5-phospho-beta-D-ribosyl)anthranilate = 5-phospho-alpha-D-ribose 1-diphosphate + anthranilate Binds 2 magnesium ions per monomer. Amino-acid biosynthesis; L-tryptophan biosynthesis; L-tryptophan from chorismate: step 2/5. Amino-acid biosynthesis; L-tryptophan biosynthesis; L-tryptophan from chorismate: step 4/5. In the N-terminal section; belongs to the TrpC family. In the C-terminal section; belongs to the anthranilate phosphoribosyltransferase family.