The defendant had a retractable knife, the court heard