Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MCP tool schemas

Every tool rekkefly mcp offers, with its arguments, as the server reports them in tools/list. Unknown arguments are rejected, and a tool that fails returns isError: true with the reason. How to connect a client, and an example session: AI agents (MCP).

ToolWhat it doesRead-only
list_camerasList camerasYes
list_configsList rig configsYes
get_configRead a configYes
update_configChange a configNo
start_rigStart a rigNo
launch_rigsStart every rig in a manifestNo
rig_statusRig status and live anglesYes
measureMeasure a rig for a whileYes
stop_rigStop a rigNo
recordStart or stop recordingNo
save_backgroundSave the backgroundNo
snapshotLook at the trackingYes
track_videoTrack a video fileNo
clip_videoCut a videoNo
benchmarkMeasure tracking speedYes

list_cameras

Cameras this computer can open, with the numbers to use as device.

No arguments.

list_configs

Every rig config (.toml) in the config folder with its camera or video, outputs and whether it is running, plus rig manifests (rigs.toml).

No arguments.

get_config

A rig config as JSON (every field) and as its commented TOML file, which explains each setting.

ArgumentTypeRequiredMeaning
configstringYesA config name in the config folder (camera-a, bogong-moth) or a path to a .toml file.

update_config

Change fields of a rig config and save it (comments in the file are kept). changes is a JSON merge patch on the get_config JSON, for example {“tracking”: {“left”: {“spike_width_deg”: 6}}} or {“head”: {“x”: 320, “y”: 170}}. Invalid values are rejected and nothing is written. A rig running this config picks up marker and detector changes at once; source and output changes need a restart.

ArgumentTypeRequiredMeaning
changesobjectYesThe fields to change, nested as in get_config.
configstringYesA config name in the config folder (camera-a, bogong-moth) or a path to a .toml file.
createbooleanCreate the config from the defaults if it does not exist (default false).

start_rig

Start tracking headless with a config and publish its outputs (Kinefly ZMQ, UDP). Give a camera device, a video file or demo to override the config’s source for this run only; the other overrides apply to this run only too. Returns the rig’s status once it shows its first frame (or fails).

ArgumentTypeRequiredMeaning
configstringA config name or path. Default: the next free rig config (camera-a, camera-b, …).
demobooleanTrack the simulated fly for this run.
devicestringCamera for this run: auto, a number from list_cameras, a device path or part of the name.
fastbooleanWith a video: as fast as possible instead of at its frame rate.
framesinteger, ≥ 0Stop after this many frames.
labelstringLabel (instance name) for this run; also the rig’s id here.
loopbooleanWith a video: play it in a loop.
recordbooleanRecord video from the start.
udp_portinteger, ≥ 0Send UDP measurements from this local port for this run.
udp_targetstringSend UDP measurements to this IP:port for this run.
videostringTrack this video file for this run (AVI natively; other formats need FFmpeg). Uses the video’s own markers if it has them.
wait_secondsnumber, ≥ 0How long to wait for the first frame (default 5).
zmq_portinteger, ≥ 0Publish Kinefly ZMQ on this TCP port for this run.

launch_rigs

Start every enabled rig in a rig manifest (rigs.toml): each with its own label, camera or video and ports. All or none: if one cannot start, the others are stopped again.

ArgumentTypeRequiredMeaning
demobooleanUse the simulated fly for every rig (to test ports and labels).
framesinteger, ≥ 0Stop each rig after this many frames.
manifeststringManifest name or path (default rigs).
recordbooleanRecord every rig.

rig_status

Status of one running rig (or all): frames, frame rate, tracking time, the latest wing angles in degrees (left, right, L−R, head, abdomen), recording and outputs.

ArgumentTypeRequiredMeaning
rigstringA running rig’s label, as rig_status lists it.

measure

Collect every frame of a running rig for some seconds and summarise each angle in degrees (frames measured, mean, spread, minimum, maximum), for example the mean L−R of a trial. skipped_frames counts gaps in the camera’s frame numbers: exposures the camera dropped, or that could not be delivered. Optionally writes every frame to a CSV. Blocks for seconds.

ArgumentTypeRequiredMeaning
csvstringAlso write every frame here (degrees).
rigstringYesA running rig’s label, as rig_status lists it.
secondsnumber, ≥ 0How long to measure (default 5, at most 600).

stop_rig

Stop a rig (or every rig if none is named), finishing any recording, and return its final status.

ArgumentTypeRequiredMeaning
rigstringA running rig’s label, as rig_status lists it.

record

Start or stop recording a running rig’s camera to its recording folder (MJPEG AVI by default).

ArgumentTypeRequiredMeaning
enabledbooleanYestrue starts, false stops.
rigstringYesA running rig’s label, as rig_status lists it.

save_background

Save the rig’s next frame as its background image, for background subtraction. Capture an empty scene first.

ArgumentTypeRequiredMeaning
rigstringYesA running rig’s label, as rig_status lists it.

snapshot

An image of a frame with the tracking drawn on it (body axis, sectors, detected edges) and its angles. Use rig for the latest live frame, or video (with frame and optionally config) for any frame of a file. Check this after moving markers.

ArgumentTypeRequiredMeaning
configstringWith video: the config whose markers to use (default: the video’s own, or the defaults).
frameinteger, ≥ 0With video: the frame number (default 0).
rigstringA running rig’s label, as rig_status lists it.
videostringA video file, instead of a running rig.
widthinteger, ≥ 0Image width in pixels (default 640).

track_video

Track every frame of a video as fast as possible and summarise it: frames per second, tracking time, and mean, spread and range of each angle. Optionally writes a CSV (one row per frame) and the full measurements as JSON lines.

ArgumentTypeRequiredMeaning
configstringConfig whose markers and settings to use (default: the video’s own markers, or the defaults).
csvstringWrite per-frame angles here.
framesinteger, ≥ 0Stop after this many frames.
jsonlstringWrite full measurements here.
methodstring: "robust", "classic"Override the wing detector: robust (ignores legs and antennae) or classic (Kinefly’s strongest edge).
videostringYesThe video file.
video_markersbooleanUse the video’s own markers (a .toml beside it) even when a config is given.

clip_video

Cut part of a video into a new, usually much smaller AVI. Never overwrites.

ArgumentTypeRequiredMeaning
durationnumber, ≥ 0Seconds to keep (default: to the end).
everyinteger, ≥ 0Keep every Nth frame.
formatstring: "mjpeg", "png", "raw"mjpeg (small, default), png (lossless) or raw.
inputstringYesThe video to cut (AVI natively; other formats need FFmpeg).
outputstringYesThe new AVI file.
qualityinteger, ≥ 0MJPEG quality 1–100 (default 90).
startnumber, ≥ 0Seconds to skip.

benchmark

Tracking time per frame for a config on a synthetic frame (no camera needed).

ArgumentTypeRequiredMeaning
configstringConfig to measure (default: the defaults, 640×480).
framesinteger, ≥ 0Frames to time (default 2000).