Staff and patients at Trinity Medical Centre in Thornhill Street were left terrified after Stephen Charles Silvester entered the building at around 4pm on February 24 this year.
Prosecutor Jemima Stephenson told Leeds Crown Court that he was bleeding from his cheek and was shouting about how he was going to hurt someone as he pulled out the two knives.
He then threw them on the receptionist's desk from where they were quickly confiscated.
The 36-year-old was heard to say: "I'm going to stab someone. I just want these voices to stop."
He then left the building and began drinking from a bottle of gin and playing music on his phone, giving staff the chance to lock the doors.
Silvester was picked up by officers in Kirkgate a short time later, where they found a five inch Stanley knife on him and two more in his left and right trainers.
He told them that he had the knives because he was hearing voices telling him to kill someone or to stab them in the head.
Five days earlier, he had been arrested after trying to attack an officer at Wakefield Bus Station.
The police had been called at around 7pm after Silvester was found unconscious under a bench in the station. He was drunk and turned abusive when officers helped him to his feet.
He removed a razor from his pocket but managed to cut himself with it.
He then tried to lunge at one of the officers but was pushed away.
The court was told that he had been admitted to hospital earlier in the day for self harming, but left before he received treatment.
Appearing in court via video link from HMP Leeds, he admitted a charge of assault on the officer, using threatening behaviour at the medical centre and possessing a bladed article.
Silvester, of no fixed address, has 40 previous convictions for 67 offences, including violence, shoplifting, public order and harassment.
He also has a previous conviction from 2017 for possessing a bladed article in public.
Mitigating, Robin Frieze said: "It was very sad behaviour from somebody who is very troubled."
A probation report found he had a high risk of offending, harming the public and himself.
Jailing him for 12 months, Judge Christopher Batty said: "Your own personal difficulties serve to reduce the culpability in this case but it was troubling behaviour over two separate incidents involving knives."
This article was first published by the Wakefield Express.