Java 26.2
Clear Command
Clear
@p
/clear @p minecraft:stone
Inventory clear
A bare /clear wipes the whole inventory. The scoped forms are the useful ones: name an item id to remove only that item, cap the count to charge a fee instead of taking everything, and set the max to 0 to count matching items without removing any.
Set the max count to 0. /clear <target> <item> 0 reports how many the player has and removes nothing, which is the standard way to test an inventory before acting on it.
Name the item id and, optionally, a max count. /clear @p minecraft:dirt 64 removes up to 64 dirt and leaves everything else; a bare /clear wipes the whole inventory.
On modern versions you can add a component or NBT filter so only items matching that data are cleared -- useful for removing a specific named quest item without touching similar plain items.
Java 26.2
@p
/clear @p minecraft:stone