A tool fastening mechanism having a housing, which has a clamping opening for receiving a shaft of a tool to be fastened, wherein the clamping opening tapers downward in a first direction, in which in use the tool shaft is introduced into the clamping opening, and which also tapers in a second direction extending perpendicular to the first direction, having an opening in the housing which intersects the clamping opening, and having a locking pin, which is movable in the opening between a first position, in which it is retracted out of the clamping opening, so that in use it allows the tool shaft to be introduced into and removed from the clamping opening, and a second position, in which it protrudes into the clamping opening, so that in use it takes the tool shaft into engagement, in order to prevent the shaft from being pulled out of the opening, and wherein upon introduction of the tool shaft into the opening in use, the tapering of the opening in the first direction restricts a motion of the shaft in a third direction extending perpendicular to the first and second directions, which tapering of the opening in the second direction lends the shaft an engagement action and presses it against one side of the opening, in order to restrict a motion In the second direction, and engagement of the locking pin with the shaft restricts a motion in the first direction, as a result of which all six degrees of freedom of the tool shaft are restricted.