Condition for checking the state of the I/O pin(dual filament run out sensor)

thank you for creating klipper to the world

I am facing a issue ,i am making a printer that has three tools
It has two nozzle setup called dual extrution
It has lasser tool for cutting and engraving
It has two nozzle setup called duplicator which copy the signal of E0 stepper and use it to E1 extruder and divides the build plate into half.(e.g total build plate is 300mmx300mm then at duplicator 150mmx300mm and 150mmx300mm)

In this we use filament sensor for dual it has two pins for signal to check in which extruder the filament runs out.
so if i parallel the signal pin of two endstop switch and make it as single pin switch then system dont know on which extruder the filament is not there,so i need a condition that IF TOOL1 ACTIVATED THEN CHECK FOR TOOL 1 SENSOR STATE.IF STATE==1 CONTINUE PRINTING ELSE STOP THE PRINT AND IF TOOL2 ACTIVATED THEN CHECK FOR TOOL 2 SENSOR STATE.IF STATE ==1 CONTINUE PRINTING ELSE STOP .
OR is there any condition for checking the state of the filament sensor like end stop

See Macro Creation Tutorial - #8 by mental
Example: Search Printer Objects

If your intention cannot be handled by a macro, then a change to the code base is necessary, which would require a willing developer to implement

this sounds like it could work with 2 gcode_buttons that then trigger the runout logic conditionally?