Using firewall rule IDs to enable/disable

I want to write some scripts to easily enable and disable certain firewall rules. I have given the rules each a comment that makes them easy to find. For example, I can use a command like this:

ip firewall filter find comment~"foo"

This returns a list of rule IDs. However, to enable or disable the rules I need to know their numbers. Is there an easy way to translate a rule ID into the corresponding rule number?