NH3 is a good complexing agent because it's a good Lewis base. It has a good tendency to donate electrons and also has good ability to form stable complexes. A very prominent example of NH3 is-
The test for the presence of the chloride ion involves silver nitrate reacting with the chloride ion to form a white precipitate which is soluble in ammonia solution. Here ammonia acts a good complexing agent.The solubility of the the silver complex with ammonia acts as a deciding factor in determining the ion since only silver chloride is soluble in ammonia while silver bromide and iodide are not but they have similar colour.