A machine tool for machining pre-toothed workpieces, comprising: a workpiece carrier; a workpiece spindle arranged on the workpiece carrier and defining a workpiece spindle axis, the workpiece spindle having a workpiece spindle housing and a workpiece spindle shaft rotatable in the workpiece spindle housing about the workpiece spindle axis for rotationally driving a pre-toothed workpiece to be machined; a meshing sensor configured to detect a phase position of teeth of the workpiece when the workpiece rotates about the workpiece spindle axis, characterized in that the machine tool further comprises: a calibration piece located at a defined calibration point (C M) relative to the workpiece spindle; and a sensor controller configured to carry out the following method: moving the meshing sensor relative to the workpiece spindle to a calibration position (P C) in which the meshing sensor is located at the calibration piece; determining a response behavior of the meshing sensor by the sensor controller moving the meshing sensor relative to the calibration piece while receiving sensor calibration signals of the meshing sensor, and moving the meshing sensor to a workpiece measuring position (P W) in which the meshing sensor is located at the workpiece, wherein the workpiece measuring position (P W) depends on the determined response behavior. a workpiece carrier; a workpiece spindle arranged on the workpiece carrier and defining a workpiece spindle axis, the workpiece spindle having a workpiece spindle housing and a workpiece spindle shaft rotatable in the workpiece spindle housing about the workpiece spindle axis for rotationally driving a pre-toothed workpiece to be machined; a meshing sensor configured to detect a phase position of teeth of the workpiece when the workpiece rotates about the workpiece spindle axis, characterized in that the machine tool further comprises: a calibration piece located at a defined calibration point (C M) relative to the workpiece spindle; and a sensor controller configured to carry out the following method: moving the meshing sensor relative to the workpiece spindle to a calibration position (P C) in which the meshing sensor is located at the calibration piece; determining a response behavior of the meshing sensor by the sensor controller moving the meshing sensor relative to the calibration piece while receiving sensor calibration signals of the meshing sensor, and moving the meshing sensor to a workpiece measuring position (P W) in which the meshing sensor is located at the workpiece, wherein the workpiece measuring position (P W) depends on the determined response behavior. a calibration piece located at a defined calibration point (C M) relative to the workpiece spindle; and a sensor controller configured to carry out the following method: moving the meshing sensor relative to the workpiece spindle to a calibration position (P C) in which the meshing sensor is located at the calibration piece; determining a response behavior of the meshing sensor by the sensor controller moving the meshing sensor relative to the calibration piece while receiving sensor calibration signals of the meshing sensor, and moving the meshing sensor to a workpiece measuring position (P W) in which the meshing sensor is located at the workpiece, wherein the workpiece measuring position (P W) depends on the determined response behavior. moving the meshing sensor relative to the workpiece spindle to a calibration position (P C) in which the meshing sensor is located at the calibration piece; determining a response behavior of the meshing sensor by the sensor controller moving the meshing sensor relative to the calibration piece while receiving sensor calibration signals of the meshing sensor, and moving the meshing sensor to a workpiece measuring position (P W) in which the meshing sensor is located at the workpiece, wherein the workpiece measuring position (P W) depends on the determined response behavior.