Rats and mice both need water, food, and shelter. It you can take any of these away, they will not stay. This works better than trapping or poison because others will not move in.
Shelter is nesting areas - for sleeping as well as rearing young. Shelter is also hiding places while they move between nesting areas, water, and food.
The more bare you can get the area in and around the coop, the less attractive it is for the rats and mice. Better, is bare around the outside of the coop and have no places they can get into the coop.
Do you have what we call hardware cloth? It is wires about a half a mm in diameter welded together about 12 mm apart to make a flat mesh then galvanized. It is called other things in other parts of the world.
Or metal lath? It looks like the picture and is usually used as a base for stucco. The holes are about 12mm in the largest direction.
Either hardware cloth or metal lath can block access into the coop - cover windows, ventilation openings, openings between the rafters, drains if there are any, and so on. Also anyplace they have chewed through walls or floors. Rats will tunnel under wall and come up through the floors. Since mesh on the floor is not good for chickens, it is better to stop the rats on the outside - at least after they are gone. Burying works if it goes deep enough but it is much easier to lay it flat on the ground. Attach it to the building and let it lay out at least 2/3 of a meter. Burying it a few cm helps and looks better.
Rats will dig, not be able to get past the mesh, try a different spot or several different spots. But they will nearly always try next to the coop wall and move along the wall rather than move further out from the wall.