Can you grapple a creature as an opportunity attack?

This came up in a game I was in the other day, so I’m curious as to know what people think.

A gnome was attempting to flee past us up the stairs and I declared that I’d like to try and stop him, by using my reaction to make a grapple attack of opportunity. My DM declared that I wasn’t able to use grapple as an AoO (obviously what the DM says is fine, but I want to know what RAW/RAI says). Instead I had to “attack” the gnome with non-lethal force (which scared the gnome into running more).

Can you grapple as an attack of opportunity?

Grappling:

When you want to grab a creature or wrestle with it, you can use the Attack action to make a special melee attack, a grapple. If you’re able to make multiple attacks with the Attack action, this attack replaces one of them. (PHB pg.195)

Attacks of Opportunity:

You can make an opportunity attack when a hostile creature that you can see moves out of your reach. To make the opportunity attack, you use your reaction to make one melee attack against the provoking creature. The attack interrupts the provoking creature’s movement, occurring right before the creature leaves your reach. (ibid)

My thoughts on this are that

  • RAW: You need to use the Attack action to make a grapple.
  • RAI: Grapple is an a melee attack and can be used as an opportunity attack.