I'm assuming you mean reacting with the probe itself?
We know the atmospheric composition of these bodies.
The examples you listed:
Mercury, from NASA:
Instead of an atmosphere, Mercury possesses a thin exosphere made up
of atoms blasted off the surface by the solar wind and striking
meteoroids. Mercury's exosphere is composed mostly of oxygen, sodium,
hydrogen, helium, and potassium.
Enceladus, from Wikipedia (also backed by other sources):
91% water vapor 4% nitrogen
3.2% carbon dioxide
1.7% methane
Triton, from NASA:
Triton's thin atmosphere is composed mainly of nitrogen with small
amounts of methane.
According to some people on Quora and this site, The Apollo LEM was made of Aluminium (Aluminum) and a little bit of steel. While alumnium is quite reactive, it quickly forms an unreactive layer with the oxygen in our atmosphere, stopping it from reacting. Obviously this isn't a great example because the LEM didn't go in an atmosphere. According to NASA, the Persaverance rovers were also made of aluminium and titanium, so the point stands.
So, I guess they just work out what the atmospheric composition is, and build spacecraft out of relatively unreactive elements. Obviously things like RTGs will have unstable elements, but they are protected by inert materials.
Hopefully this helped?