Okay, so, how does magic work? Magic, at the end of the day, is a swarm of tiny machines (hardly visible to the naked eye, but still within the 10-100 micrometer range) that carry out a task.
Individual machines have tiny manipulators with a "hand" that they can use to lock together and share info and energy. They create larger, temporary structures to help them move across the air. Power source is usually wireless energy transfer (broadcast or narrowcast with relays) and they can cover some distance on battery power.
Usually, they either carry some kind of a substance (that could be actual nanomachines) or are they themselves are doing the "magic" like pure-carbon bots immolating themselves and creating an explosion.
Now, given this magic, I'm trying to come up with a spell that can brick any firearm and even smaller anti-aircraft guns, brick as in render unusable for the longest possible time.
The spell should consume little resources, act quickly and should be very hard to counter, even by other bot swarms.
How could such spell work?
Note: I found this question, it could maybe help:
https://www.quora.com/What-parts-of-an-assault-rifle-are-most-commonly-replaced-on-say-a-M4-or-FAL