How can I use treesitter in a function to toggle booleans?

I am trying to create a function to toggle boolean values in this fasshion:

one boolean toggle it regardless cursor position
two or more toggle just the one under the cursor

I would like a function I can use in a utils file and require via keymap to toggle booleans in the current line