In this study we investigate the structural and chemical changes of monatomic CoO2 chains grown self-organized on the Ir(100) surface [P. Ferstl et al., PRL 117, 2016, 046101] and on Pt(100) under reducing and oxidizing conditions. By a combination of quantitative low-energy electron diffraction, scanning tunnelling microscopy, and density functional theory we show that the cobalt oxide wires are completely reduced by H2 at temperatures above 320 K and a 3×1 ordered Ir2Co or Pt2Co surface alloy is formed. Depending on temperature the surface alloy on Ir (100) is either hydrogen covered (T < 400 K) or clean and eventually undergoes an irreversible order-disorder transition at about 570 K. The Pt2Co surface alloy disorders with the desorption of hydrogen, whereby Co submerges into subsurface sites. Vice versa, applying stronger oxidants than O2 such as NO2 leads to the formation of CoO3 chains on Ir(100) in a 3×1 superstructure. On Pt(100) such a CoO3 phase could not be prepared so far, which however, is due to the UHV conditions of our experiments. As revealed by theory this phase will become stable in a regime of higher pressure. In general, the structures can be reversibly switched on both surfaces using the respective agents O2, NO2 and H2.