optimise tool status query