In order to determine the mental condition of any party or witness before any court of the commonwealth, the presiding judge may, in his discretion, request the department to assign a qualified physician or psychologist, who, if assigned shall make such examinations as the judge may deem necessary.
Mass. Gen. Laws ch. 123, § 19