pir-mcp
v0.1.0Motion 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.
| Parameter | Type | Description |
|---|---|---|
h * | integer | height, pixels |
name * | string | |
w * | integer | width, pixels |
x * | integer | left edge, pixels |
y * | integer | top edge, pixels |
masks | array |
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).
| Parameter | Type | Description |
|---|---|---|
name * | string | |
window * | string | |
masks | array |
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.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
purpose | string | one 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.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
purpose | string | one 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.
| Parameter | Type | Description |
|---|---|---|
name * | string |
pir_list_regions
The regions currently defined, with their geometry and masks.
pir_remove_region
Forget a region.
| Parameter | Type | Description |
|---|---|---|
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?'.
| Parameter | Type | Description |
|---|---|---|
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'.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
interval_ms | integer | sampling period (default 500) |
metric | string | what 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). |
threshold | number | score 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_ms | integer | give 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.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
still_for_ms * | integer | how long nothing may change |
interval_ms | integer | sampling period (default 500) |
metric | string | what 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). |
threshold | number | score 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_ms | integer | give up after this long (default 55000, max 540000) |