A surgical device has a handle assembly and an elongated member extendingdistallyfrom the handle assembly. A tool assembly is mounted to a distal end of theelongatedmember. The tool assembly has a cartridge assembly having a plurality ofstaples. The toolassembly further has an anvil assembly. At least one of the anvil assembly andthe cartridgeassembly is movable in relation to each other between open and closedpositions. At least oneof the anvil assembly and the cartridge assembly has at least a portionconfigured fortransitioning between a longitudinally extended state and a longitudinallyretracted state. Atransitioning mechanism is configured to transition at least one of the anvilassembly and thecartridge assembly between the extended and retracted states.