How do I summon a weapon or tool with a low durability

I'm trying to make a custom npc map for myself.
I need a command that will summon a weapon that has low durability so it can by dropped by the npc.

Can anyone give me an example on how to do it?


Another thing that should be taken into account is that you cannot change the maximum durability of an item unless you use some sort of datapack or mod, but other than that you can change the number of uses it has left.

In 1.12 and before:
/give @p minecraft:diamond_sword 1 100

In 1.13 and after:
/give @p minecraft:diamond_sword{Damage:100} 1


Add the Damage tag to the command: /give @s diamond_sword{Damage:780} This will give you a half durability sword, or at least as close to half as you can get because a diamond swords durability is 1561