Role of the Magnetic Anisotropy in Atomic-Spin Sensing of 1D Molecular Chains.