Proficiency with thieves' tools, per optional rules in Xanathar's
Xanathar's Guide to Everything has a section on tool proficiencies that details what each tool set contains, a list of skill checks (for specific purposes) that proficiency with that tool grants advantage on, a possible special use of that tool for those who are proficient, and a short list of sample activities that can be performed with the tool along with suggested DCs for the necessary ability checks.
As you have reasoned, the special use listed for thieves' tools (per p. 84) is:
Set a Trap. Just as you can disable traps, you can also set them. As part of a short rest, you can create a trap using items you have on hand. The total of your check becomes the DC for someone else’s attempt to discover or disable the trap. The trap deals damage appropriate to the materials used in crafting it (such as poison or a weapon) or damage equal to half the total of your check, whichever the DM deems appropriate.
As this is quite open-ended, it's left to the player and DM to work out how exactly the trap works.
Roughly, the DM calls for an ability check to craft the trap (perhaps an Intelligence check with their proficiency bonus added, due to proficiency in thieves' tools - or double their proficiency bonus, if the character has Expertise with thieves' tools). That determines the DC to discover and/or disable the trap. The damage dealt by the trap is either half the total of the check (i.e. with a check of 16, it deals 8 damage) or some other number determined by the DM, with a damage type determined by the DM based on what sort of trap it is.
The snare spell
The snare spell (XGtE, p. 165) is a ranger, druid, and wizard spell that allows the caster to set a magic trap:
As you cast this spell, you use the rope to create a circle with a 5-foot radius on the ground or the floor. When you finish casting, the rope disappears and the circle becomes a magic trap.
This trap is nearly invisible, requiring a successful Intelligence (Investigation) check against your spell save DC to be discerned.
The trap triggers when a Small, Medium, or Large creature moves onto the ground or the floor in the spell’s radius. That creature must succeed on a Dexterity saving throw or be magically hoisted into the air, leaving it hanging upside down 3 feet above the ground or the floor. The creature is restrained there until the spell ends.
A restrained creature can make a Dexterity saving throw at the end of each of its turns, ending the effect on itself on a success. Alternatively, the creature or someone else who can reach it can use an action to make an Intelligence (Arcana) check against your spell save DC. On a success, the restrained effect ends.
After the trap is triggered, the spell ends when no creature is restrained by it.
It takes a minute to cast, and lasts 8 hours. It also consumes its material component, which is 25 feet of rope. You probably want to combine this with another spell like alarm (or set up some kind of nonmagical alert system), so you know when a creature has triggered your trap. Otherwise, it may simply escape the trap within a few turns.