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

hi
thank you for creating klipper to the world

I am facing a issue ,i am making a printer that has three tools
Tools.1
It has two nozzle setup called dual extrution
Tool.2
It has lasser tool for cutting and engraving
Tool.3
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 extrusion.so 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
and
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?