Cross-sectional scanning tunneling microscopy was used to study at the atomic scale the impact of the capping material on the structural properties of self-assembled InAs quantum dots (QDs) grown on a high index (311)B InP substrate. Important differences were found in the capping process when InP or lattice matched InGaAs(P) alloys are used. The QDs capped with InP have a smaller height due to As/P exchange induced decomposition. This effect is not present when InGaAs is used as the capping material. However, in this case a strong strain driven phase separation appears, creating In rich regions above the QDs and degrading the dot/capping layer interface. If the InAs dots are capped by the quaternary alloy InGaAsP the phase separation is mu...