pir-mcp

v0.1.0
io.github.Solteris-Dev/pir-mcp Checked 4 days ago Published 2 months ago

Motion sensor for AI agents: tells when a screen region changes or goes still.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

pir_define_region

Name a rectangle of the screen to watch. Coordinates are in the global layout the capture tool uses (on a multi-monitor wlroots layout an output left of the primary has negative x). Masks are rects inside the region, in region-local pixels, that are ignored: put a clock or spinner there. Redefining a name replaces it and forgets its last sample.

ParameterTypeDescription
h *integerheight, pixels
name *string
w *integerwidth, pixels
x *integerleft edge, pixels
y *integertop edge, pixels
masksarray

pir_define_window

Watch a window rather than a fixed rectangle: geometry is looked up from the window id before every capture, so the region follows the window when it moves. A resize counts as maximal change. Masks are window-local. The id is whatever your window-geometry command understands (a Hyprland address like 0x5f3a..., an X11 window id).

ParameterTypeDescription
name *string
window *string
masksarray

pir_pick_window

Ask the person at the screen to click the window to watch (visible windows are offered as boxes; Escape cancels). The region then follows that window. Prefer this over pir_define_window when a human is present.

ParameterTypeDescription
name *string
purposestringone line on why you want to watch it; returned unchanged so it lands in the transcript

pir_pick_region

Ask the person at the screen to draw the rectangle to watch (a selector such as slurp appears; Escape cancels). Prefer this over pir_define_region whenever a human is present: they choose what is sensed, and you get the geometry back. Blocks until they finish or the selector times out.

ParameterTypeDescription
name *string
purposestringone line on why you want to watch it; returned unchanged so it lands in the transcript

pir_pick_mask

Ask the person to draw a rectangle inside an existing region that should be ignored (a clock, a spinner, a caret). Forgets the region's last sample, since masked grids are not comparable to unmasked ones.

ParameterTypeDescription
name *string

pir_list_regions

The regions currently defined, with their geometry and masks.

pir_remove_region

Forget a region.

ParameterTypeDescription
name *string

pir_sample

Capture the region once and score it against the previous sample of the same region (null on the first call). Cheap and non-blocking: use it to check the capture command works, to take a baseline before doing something, or to ask 'did anything happen there since I last looked?'.

ParameterTypeDescription
name *string

pir_wait_for_change

Block until the region looks different from how it looked when this call started, or until timeout_ms. Returns changed=true with the score, or changed=false with the largest score seen. Use it as a doorbell: 'wake me when the build output moves', 'when the dialog closes', 'when the game loads'.

ParameterTypeDescription
name *string
interval_msintegersampling period (default 500)
metricstringwhat the threshold applies to. rmse (default): the whole region moved. peak: any single cell moved, for a small thing that should tick inside a larger region (a clock in a bar).
thresholdnumberscore that counts as a change, 0..1 (default 0.05). With metric=rmse a caret or cursor edge scores about 0.02 and a dialog opening 0.1+. With metric=peak a digit flipping in one cell scores about 0.05…
timeout_msintegergive up after this long (default 55000, max 540000)

pir_wait_for_stillness

Block until consecutive samples have stayed below threshold for still_for_ms, or until timeout_ms. A short window means 'the page/animation has settled, safe to act'. A long window on something that should keep changing (a clock, a progress bar, a status bar) means it is frozen: still=true is then the alarm.

ParameterTypeDescription
name *string
still_for_ms *integerhow long nothing may change
interval_msintegersampling period (default 500)
metricstringwhat the threshold applies to. rmse (default): the whole region moved. peak: any single cell moved, for a small thing that should tick inside a larger region (a clock in a bar).
thresholdnumberscore that counts as a change, 0..1 (default 0.05). With metric=rmse a caret or cursor edge scores about 0.02 and a dialog opening 0.1+. With metric=peak a digit flipping in one cell scores about 0.05…
timeout_msintegergive up after this long (default 55000, max 540000)