Immunotherapy has revolutionized cancer treatment, however, a reliable biomarker is missing. MGAT5-mediated PD-L1 glycosylation is critical for its interaction with PD-1. MGAT5 expression is a functional biomarker that predicts immunotherapy responses.