In a method for optimizing a magnetic resonance (MR) examination to be performed with an MR scanner on a patient, a token is detected that identifies a medical aid that is to be present in the MR scanner during the examination, in particular to identify an implant implanted in the patient, a medical device to be used during the MR examination or a medical prosthesis worn by the patient. At least one restriction for the planned MR examination is determined in a computer as a function of the token.