PC 991 requires "immediate" hearing if the individual is in custody on a misdemeanor. It is similar to a prelim in a felony case but based on a various documents including declarations, warrants, and police reports.
A PC 991 is almost always made orally at your arraignment by your attorney. These are difficult to win but you will have a better chance if a lawyer does it than if you do it yourself.
A PC 991 Motion can be made either orally or in writing, there is no requirement that it be done either way. If in writing, a person should include documentary evidence, sworn declarations, or reports to support his or her claim that the complaint lacks sufficient probable cause that a public offense was committed or that he or she is not the person who committed it.
My preference is to request such a hearing orally on the spot at the arraignment but to set the hearing for the matter a few days away so that I can draft a written argument unless its clear from the police report, complaint or warrant that my client was not the perpetrator, or that no crime was committed.