Debi,
Most likely he was trying to plug a hole. N. oerstedii prefer to live in a cavity with just two entrances. They will use pebbles and shells to block other entrances. Using their maxillipeds, they grasp a rock that is a close fit to a hole and try to work it into place. They may even strike to drive it in.
In the field, these plugs are overgrown and cemented into place by coralline algae. What results are small coralline algae nonules that are hollow and have one or two entrances. These are the major living sites for N. oerstedii on grass flats where rubble is scarce. If the cavity is too large, they will sometimes fill it with pebbles to reduce the volume.
Why all the modifications? A cavity with a tight fit and entrances that are just the diameter of the occupant are easier to defend from predators and other stomatopods. Homes (cavities) are usually in short supply and modifying them for the perfect fit helps the stomatopod keep its house.
Roy