It’s not obvious from context, I agree. Kalyāṇamitto can be a noun “a good friend” and an adjective “a good-friended person”, i.e. “a person with good friends”.
Taking the exact phrase in another context:
ud4.1:12.1": "Idha, meghiya, bhikkhu kalyāṇamitto hoti kalyāṇasahāyo kalyāṇasampavaṅko
Here the Buddha is instructing Meghiya, whose fault was that he prematurely went off on his own, when in fact he needed to rely on his “good friend” namely the Buddha. So here the context shows what is meant.
Another example:
“sn3.18:6.1”: "For, by relying on me as a good friend, sentient beings who are liable to rebirth, old age, and death, to sorrow, lamentation, pain, sadness, and distress are freed from all these things. ",
Mamañhi, ānanda, kalyāṇamittaṁ āgamma jātidhammā sattā jātiyā parimuccanti, jarādhammā sattā jarāya parimuccanti, byādhidhammā sattā byādhito parimuccanti, maraṇadhammā sattā maraṇena parimuccanti, sokaparidevadukkhadomanassupāyāsadhammā sattā sokaparidevadukkhadomanassupāyāsehi parimuccanti.
“sn3.18:6.2”: "This is another way to understand how good friends are the whole of the spiritual life.’ ",
Iminā kho etaṁ, ānanda, pariyāyena veditabbaṁ yathā sakalamevidaṁ brahmacariyaṁ—yadidaṁ kalyāṇamittatā kalyāṇasahāyatā kalyāṇasampavaṅkatā’ti.
In other words, “good friendship” means relying on the Buddha as a “good friend”.
I’m not sure that there is a formal definition in the sutta, but the Puggalapannatti offers one:
“pp2.2:32.1”: "Katamo ca puggalo kalyāṇamitto? ",
“pp2.2:32.2”: "Tattha katamā kalyāṇamittatā? ",
“pp2.2:32.3”: “Ye te puggalā saddhā sīlavanto bahussutā cāgavanto paññavanto, yā tesaṁ sevanā nisevanā saṁsevanā bhajanā sambhajanā bhatti sambhatti sampavaṅkatā—”,
“pp2.2:32.4”: "ayaṁ vuccati kalyāṇamittatā. ",
“pp2.2:32.5”: "Imāya kalyāṇamittatāya samannāgato puggalo “kalyāṇamitto”. ",
Rough translation:
What is “one with good friends”?
Therein, what is “good friendship”?
It is associating with those people who have faith, learning, generosity, and wisdom.
A person who is endowed with such good friendship is “one with good friends”.