Whenever required by any grand jury, it shall be the duty of the prosecuting or circuit attorney in the county, or in a city not within a county, to attend them for the purpose of examining witnesses in their presence, or giving them advice upon any legal matter.
§ 540.130, RSMo