MCP Tools Guide#
This document lists every tool exposed by the smart-community-video MCP
server — its purpose, action enum, parameters, and return shape.
Every tool id is prefixed smart_community_. Every tool is keyed on monitor_id (the camera
id, e.g., cam_child); ids are per-monitor and are never assumed unique across use cases. Times
are ISO-8601 internally — present HH:MM / HH:MM:SS to users.
The tools fall into four groups:
Group |
Tools |
|---|---|
Query & report |
|
Monitor lifecycle |
|
Use-case authoring |
|
Rules & plans |
|
1. smart_community_alert_query#
Query or acknowledge alerts. Switch mode via action.
Every row in alerts is already rule-engine-filtered, so you do not re-filter by
severity/type. severity / event / desc are not stored on the alert — they live on the
linked task and are returned via a task_id JOIN into video_summary_tasks.
Param |
Type |
Required |
Description |
|---|---|---|---|
|
string |
✅ |
Monitor ID |
|
enum |
✅ |
See below |
|
number |
— |
Max rows (default 20, for |
|
string |
— |
|
|
string |
— |
|
|
number |
— |
Alert to acknowledge (for |
|
string |
— |
Who acknowledged (for |
Actions
action |
Purpose |
Returns |
|---|---|---|
|
Newest N alerts ( |
|
|
Alerts within |
|
|
Acknowledge one alert ( |
|
|
Aggregate counts only, optional date range |
|
AlertWithTask carries taskDetails (including the user-defined extension columns such as
event / severity / desc) and eventDetails (motion type, start/end time).
2. smart_community_scene_query#
One-shot VLM look at the live frame. Reads the monitor’s latest.jpg and asks
vllm-serving-ipex (:41091, by default) to describe it now.
Param |
Type |
Required |
Description |
|---|---|---|---|
|
string |
✅ |
Frame path is |
|
string |
— |
Override prompt (default: describe the scene in 1–2 sentences) |
|
string |
— |
VLM base URL (default |
|
string |
— |
VLM model id (default |
|
number |
— |
Longest-edge cap in px (default |
Returns { scene } — the description with <think> tags stripped. Use it for any “what is
happening right now?” question, or to ask targeted questions about the current frame via a
custom prompt (e.g., “list every food item visible in the fridge”). Resized frames are archived
under segments/<monitor_id>/queries/<date>/.
3. smart_community_generate_report#
Build a period report from the DB: query a data source, build an SRT timeline, call
multilevel-video-understanding (:8192) in caption-only mode, and write a row to reports.
Data source / filter / default type are derived from config.yaml
use_case_dict[monitor.use_case].reports; tool params override the config.
Param |
Type |
Required |
Description |
|---|---|---|---|
|
string |
✅ |
Monitor ID |
|
enum |
— |
|
|
string |
— |
Inclusive start |
|
string |
— |
Inclusive end (for |
|
enum |
— |
|
|
object |
— |
Key-value filter on the data-source columns (incl. user extension columns) |
daily = today, weekly = last 7 days, monthly = last 30 days.
Returns { periodStart, periodEnd, type, dataSource, eventCount, reportText, latencySeconds }.
A debug SRT is persisted under logs/reports/.
The report is a two-layer flow: this tool produces the raw reportText; the agent/persona
then decides whether and how to push it (rewrite in the user’s voice, lead with the headline).
4. smart_community_video_db#
Low-level read-only SQL escape hatch against the SQLite DB. SELECT only — any
INSERT/UPDATE/DELETE is rejected. Use it for anything the typed tools don’t cover
(e.g., reading monitor_state).
Param |
Type |
Required |
Description |
|---|---|---|---|
|
string |
✅ |
|
|
array |
— |
Positional params for |
Returns the result-row array.
5. smart_community_monitor_ctl#
Single-monitor lifecycle, coordinating all three layers (DB + videostream-analytics + video-worker) atomically in one call.
For register_source, use_case must be a key in config.yaml’s use_case_dict; the tool runs
smart_community_use_case_validate as a pre-check and rejects registration if it fails (no DB
write, no analytics call, no worker start). video_summary_task is derived from the use case, not
passed here.
Param |
Type |
Required |
Description |
|---|---|---|---|
|
enum |
✅ |
|
|
string |
— |
Required for all except |
|
string |
— |
Source URL — any protocol analytics supports: rtsp / http / onvif / file / … (required for |
|
string |
— |
Display name (for |
|
string |
— |
|
|
object |
— |
Analytics pipeline config (default: motion + recording) |
Actions
action |
Behavior |
Returns |
|---|---|---|
|
All registered monitors + live analytics reachability |
Monitor[] ( |
|
One monitor: DB record + live analytics status |
Monitor + reachability |
|
Validate use case → coordinate DB / analytics / worker (graceful-stop stale worker, then rebuild) |
|
|
Graceful-stop worker → analytics DELETE → delete DB record |
|
|
Resume: analytics |
|
|
Pause: graceful-stop worker → analytics |
|
stop/unregisterare destructive — confirm with the user first.
6. smart_community_monitors_compose#
Docker-compose-style batch management of the monitors declared in a monitors.yaml file. The
tool reads the file from disk every time (independent of the config.monitors loaded at
server start), so it can act on a yaml at any path.
Param |
Type |
Required |
Description |
|---|---|---|---|
|
enum |
✅ |
|
|
string |
✅ |
Path to |
|
string |
— |
Act on a single monitor (default: every monitor in the file) |
Actions (compose analogues)
action |
≈ compose |
Behavior |
|---|---|---|
|
|
Validate fields only ( |
|
|
For each |
|
|
|
|
|
|
|
|
Report each monitor’s DB / analytics / worker state; no change |
down/restartare destructive — confirm first. Per-compose traces are written tologs/monitors/<monitor_id>/<YYYY-MM-DD>.log.
7. smart_community_use_case_validate#
Validate a use case end-to-end. Also runs inline as the monitor_ctl register_source pre-check;
callable standalone for a dry run.
Three sequential checks (any failure fails overall):
Known —
use_caseexists inconfig.yamluse_case_dict.Task registered — its
video_summary_taskexists in multilevel-video-understanding (GET /v1/tasks/<name>).Schema consistent — every
required: trueschema field appears in the task’sLOCAL_PROMPT(case-insensitive substring).
Param |
Type |
Required |
Description |
|---|---|---|---|
|
string |
✅ |
|
Returns { valid, use_case, video_summary_task, checks, required_fields, optional_fields, missing_required_in_prompt, missing_optional_in_prompt, prompt_tail, suggestion }. valid is
decided by required fields only; on failure prompt_tail gives the last ~200 chars of the prompt
to help locate the fix.
8. smart_community_use_case_register#
Manage a use case’s lifecycle at runtime, without restarting the server.
action: generate_task— step 1 of the recommended two-step flow: run the schema↔prompt consistency check,POST /v1/tasksto multilevel-video-understanding (auto-PATCHon 409), and on success write$SMART_COMMUNITY_DATA_DIR/use-cases/<use_case>/prompt.mdto disk (~/.mcp-smart-communityis the default data directory). On the custom rule path, passevaluate_rules_path; the tool reads that file for the consistency check, stages it to the same use-case directory asevaluate_rules.py, and smoke-tests the staged file. Does not touch the DB schema,use_case_dict, orconfig.yaml.prompt_textis required here.Any Final Schema field beyond
severity/event/descrequiresevaluate_rules.py. Bothgenerate_taskandregisterreject an extended schema without a rule before DB, VLM, config, or artifact side effects.action: register— (1) applyschema_extensionsviaALTER TABLE(idempotent), (2)POST /v1/tasksto multilevel-video-understanding (auto-PATCHon 409), (3) inject the entry into the in-memoryuse_case_dictso the task-poller and other tools see it, (4) re-runuse_case_validate. Withpersist: true, also writes the entry back toconfig.yaml(comment-preserving). As step 2 of the two-step flow, omitprompt_text— it is auto-read from the filegenerate_taskwrote. Ifevaluate_rules_pathis supplied it is staged to<data_dir>/use-cases/<use_case>/evaluate_rules.py(auto-discovered when the file is already there, e.g., staged by step 1), and that conventional absolute path is stored inconfig.yamlfor runtime rule execution.action: unregister—DELETE /v1/tasks/<name>and remove fromuse_case_dict. The VLM delete is skipped when another use case shares the task. Every referencing monitor is detached (worker stopped, analytics source removed, DB row left offline with history retained). Withpersist: true, the entries are also removed fromconfig.yamlandmonitors.yaml, then<data_dir>/use-cases/<use_case>/is moved to<data_dir>/use-cases/.backup/. Incomplete cleanup keepsok: truefor the removed in-memory entry but setsdegraded: trueand explains the failure inwarnings.action: list— read-only inventory of the live in-memoryuse_case_dict; needs no other arguments. Returns one entry per use case withvideo_summary_task,schema_fields,rule_path(defaultRuleEvaluator|evaluate_rules.py|none), andreport_source. This reflects what the running server actually uses — including entries registered withpersist: false— so prefer it over parsingconfig.yamlfrom disk. Call it after a successful register/unregister to report the system’s current use cases.
Prompt authoring is out of scope here — draft the ## LOCAL_PROMPT with the
smart-community-use-case-manager skill, then pass it via prompt_text (or let register auto-read
<data_dir>/use-cases/<use_case>/prompt.md).
Param |
Type |
Required |
Description |
|---|---|---|---|
|
enum |
✅ |
|
|
string |
✅ (not for |
Key matching |
|
string |
— |
VLM task name (default |
|
string |
— |
Human description shown by |
|
string |
required for extended schema/custom alerts |
Path to a custom |
|
object |
— |
|
|
object |
— |
Per-clip summarize config |
|
string |
✅ for |
Full 4-section prompt (Markdown or raw Python). For |
|
array |
— |
Extra |
|
boolean |
— |
Replace an existing entry (default false) |
|
boolean |
— |
Mirror the mutation into the booted |
9. smart_community_plan_ctl#
Per-monitor plans: arbitrary JSON records keyed by name. The rule engine can read today’s plan before deciding whether to fire. Plan shape is user-defined; the tool doesn’t interpret it.
Param |
Type |
Required |
Description |
|---|---|---|---|
|
string |
✅ |
Monitor ID |
|
enum |
✅ |
|
|
string |
— |
Unique plan name within the monitor (required for |
|
object |
— |
Plan data (for |
|
string |
— |
Optional |
|
boolean |
— |
Return only active plans (default true, for |
delete is a soft delete (active=0, data retained) — still treated as destructive; confirm
first.
10. smart_community_rule_eval#
Manually re-run the rule evaluator against a completed task (defaults to the monitor’s latest
completed task). Rebuilds the same RuleContext the task-poller uses. Dry by default.
Param |
Type |
Required |
Description |
|---|---|---|---|
|
string |
✅ |
Monitor ID |
|
number |
— |
Task to re-evaluate (default: latest completed for the monitor) |
|
boolean |
— |
When true, insert an alert row on |
In normal operation you never call this: alerts are created automatically by the worker’s rule-engine callback when a summary task completes.
rule_evalis a debugging / manual-replay aid.
Tool summary#
Tool |
Key traits |
|---|---|
|
|
|
vllm-serving-ipex; live-frame VLM; ffmpeg resize; frame archive; |
|
SRT build; caption-only VLM; writes |
|
read-only |
|
single-monitor lifecycle; atomic DB+analytics+worker; use-case pre-check |
|
docker-compose over a yaml; |
|
3-step wiring check; case-insensitive; returns missing fields |
|
runtime use-case register/unregister; schema ALTER; |
|
per-monitor JSON plans CRUD; soft-delete |
|
manual re-run of the rule evaluator; dry by default |
Data model (SQLite)#
smart_community_video_db reads these tables (SELECT only):
monitors — registered cameras:
id(= monitor_id),name,source_url,use_case,video_summary_task,status.events —
motionandstaticpipeline events:motion_type,start_time,end_time,duration_seconds, optional clip/prefilter fields, andtrajectory_region. Continuousrecordingpayloads are stored in the separaterecordingstable; VSA connection status is exposed by its control API and is not inserted here.video_summary_tasks — one per motion clip:
id,monitor_id,event_id,summary_clip_input,status(pending | processing | completed | failed | ignored),summary_text(raw VLM output), error/latency/token fields, plus user-defined extension columns declared by that use case underuse_case_dict.<use_case>.schema.video_summary_tasks.extensions(commonlyevent,severity, anddesc).alerts — use-case-agnostic rule-engine output:
id,monitor_id,task_id,event_id,use_case,description,notified,created_at,ack_at,ack_by. Read structured fields such asseverityoreventby joiningtask_idtovideo_summary_tasks.recordings —
file_path,start_time,end_time,duration_seconds,file_size_bytes.reports — generated report rows (from
generate_report).plans — per-monitor JSON plans (
plan_ctl).monitor_state — per-monitor runtime state as JSON (e.g.,
last_alert_at, use-case keys such aslast_get_up_at).