We report a detailed theoretical investigation on the functionalization of semiconducting (10,0) and metallic (6,6) single-walled carbon nanotubes (SWNTs) with a series of metalloporphyrin (MP) complexes (MP = CoP, NiP, CuP, and ZnP) by using density functional theory (DFT) calculations. We find that similar to the free-base porphyrin, metalloporphyrin molecules can also be used to separate the semiconducting SWNTs from metallic SWNTs. The mechanisms for separation are mainly attributed to the difference in charge transfer and hybridization between metalloporphyrin molecules and SWNTs. However, contrasting with the porphyrin-SWNTs systems, the presence of the unpaired electrons in the metalloporphyrin-SWNTs assembly implies a nonzero magnetic moment of this material, making it possess interesting magnetic and optic properties. Moreover, the metalloporphyrin-SWNTs composites also have potential applications in further fabricating nanotube electronic devices for sensors, catalysts, or spintronic molecular devices in solution. Hence the present results should provide useful information for the functionalization chemistry of SWNTs.