Tuning the cooperativity in spin-state switching of molecules in contact to surfaces