"I had been playing with pain but it was getting too much, " Richards revealed in his BBC Sport website column.
"Physio Ally Beattie felt if I did not have it sorted it could get worse and keep me out long term.
"They told me what was happening on Tuesday and I whizzed down to London on the train on Wednesday for the operation at the Lister Hospital in Chelsea."
He added: "All they want me to do now is sit and rest. After that I will be back on the treadmill and building up the muscle that was lost.
"Then I will be in the pool and doing more running. It is important to come back steadily.
"I am all right though. I am not on crutches and my leg is fine to walk on. I can drive too."