Nice clean code actually, good job!
One mistake in it: the command gets printed to the chat. You need to do a "return false" between lines 9 and 10 to tell the chat not to send the actual command as a message.
If you want to satisfy the perfectionist in me: the first if clause from line 3 to 10 is indented one too far. The if and end should be on the same level as the local variable declaration in line 2.
Also, it s a best practice not to declare and assign variables before you need them in the code. In the code right now, you assign the inventory variable every time the player writes ANY chat message. You would want to put it behind the args.text == "/clear" check so it only assigns it when it is actually needed.
Alternatively, you can even remove the declaration in line 2 entirely and call the clear inventory function inside the table.count on line 4 like this: table.count(args.player:GetInventory())
Just some basic suggestions