video-analytics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Video Analytics (VA-MCP)

视频分析(VA-MCP)

Queries incidents, alerts, and metrics stored in Elasticsearch via MCP JSON-RPC at port 9901.
ALWAYS run the commands below yourself and relay results to the user. Do NOT guess or describe — actually execute and report back.

通过MCP JSON-RPC(端口9901)查询存储在Elasticsearch中的事件、警报和指标。
请务必自行运行以下命令并将结果反馈给用户。请勿猜测或描述——实际执行后再汇报结果。

Deployment prerequisite

部署前提条件

This skill reads from the Elasticsearch/VA-MCP stack brought up by the VSS alerts profile (either
verification
or
real-time
mode). Before any query:
  1. Probe the VA-MCP endpoint:
    bash
    curl -sf --max-time 5 "http://${HOST_IP}:9901/mcp" >/dev/null 2>&1 || \
      curl -sf --max-time 5 "http://${HOST_IP}:9901/" >/dev/null
  2. If the probe fails, ask the user:
    "The VSS
    alerts
    profile isn't running on
    $HOST_IP
    (VA-MCP unreachable). Which mode should I deploy —
    verification
    (CV) or
    real-time
    (VLM)?"
    • Answer → hand off to the
      /deploy
      skill with
      -p alerts -m <mode>
      . Return here once it succeeds.
    • If the user declines → stop. No incidents/alerts/metrics to query without the alerts stack up.
    (If your caller has granted explicit pre-authorization to deploy autonomously — e.g. the request says "pre-authorized to deploy prerequisites", or you are running in a non-interactive evaluation harness with that permission — skip the confirmation and invoke
    /deploy
    directly. Default the mode to
    verification
    unless the request specifies otherwise.)
  3. If the probe passes, proceed.

本技能读取由VSS
alerts
配置文件(
verification
real-time
模式)启动的Elasticsearch/VA-MCP堆栈中的数据。查询前请先完成以下步骤:
  1. 探测VA-MCP端点:
    bash
    curl -sf --max-time 5 "http://${HOST_IP}:9901/mcp" >/dev/null 2>&1 || \
      curl -sf --max-time 5 "http://${HOST_IP}:9901/" >/dev/null
  2. 如果探测失败,请询问用户:
    "VSS
    alerts
    配置文件未在
    $HOST_IP
    上运行(VA-MCP无法访问)。我应该部署哪种模式——
    verification
    (CV)还是
    real-time
    (VLM)?"
    • 用户答复后 → 将任务转交给
      /deploy
      技能,参数为
      -p alerts -m <mode>
      。部署成功后再返回此处。
    • 如果用户拒绝 → 停止操作。没有运行的alerts堆栈则无法查询事件/警报/指标。
    (如果调用者已明确授权自主部署——例如请求中注明"已预先授权部署前提条件",或您在具备该权限的非交互式评估环境中运行——则无需确认,直接调用
    /deploy
    。默认模式为
    verification
    ,除非请求中另有指定。)
  3. 如果探测成功,继续执行后续步骤。

REQUIRED: Two-Step Pattern (copy this exactly)

必填:两步式流程(严格照搬此步骤)

Every query requires two shell commands run in sequence:
bash
undefined
每次查询都需要按顺序运行以下两条shell命令:
bash
undefined

Step 1: initialize — get session ID from response HEADER

步骤1:初始化——从响应HEADER中获取会话ID

SESSION_ID=$(curl -si -X POST http://localhost:9901/mcp
-H "Content-Type: application/json"
-H "Accept: application/json, text/event-stream"
-d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"cli","version":"1.0"}},"id":0}'
| grep -i "mcp-session-id" | awk '{print $2}' | tr -d '\r')
SESSION_ID=$(curl -si -X POST http://localhost:9901/mcp
-H "Content-Type: application/json"
-H "Accept: application/json, text/event-stream"
-d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"cli","version":"1.0"}},"id":0}'
| grep -i "mcp-session-id" | awk '{print $2}' | tr -d '\r')

Step 2: call the tool using the session ID in the header

步骤2:使用请求头中的会话ID调用工具

curl -s -X POST http://localhost:9901/mcp
-H "Content-Type: application/json"
-H "Accept: application/json, text/event-stream"
-H "mcp-session-id: $SESSION_ID"
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incidents","arguments":{"max_count":10}},"id":1}'
| grep '^data:' | sed 's/^data: //' | jq -r '.result.content[0].text'

> The session ID comes from the **response header** `mcp-session-id`, not the body.
> Skipping Step 1 always results in `Bad Request: Missing session ID`.

---
curl -s -X POST http://localhost:9901/mcp
-H "Content-Type: application/json"
-H "Accept: application/json, text/event-stream"
-H "mcp-session-id: $SESSION_ID"
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incidents","arguments":{"max_count":10}},"id":1}'
| grep '^data:' | sed 's/^data: //' | jq -r '.result.content[0].text'

> 会话ID来自响应头`mcp-session-id`,而非响应体。
> 跳过步骤1总会导致`Bad Request: Missing session ID`错误。

---

Tool Reference

工具参考

Replace the
-d
payload in Step 2 with any of the following.
将步骤2中的
-d
负载替换为以下任意一种即可。

video_analytics__get_incidents

video_analytics__get_incidents

ParameterTypeDescription
source
stringSensor ID or place name (optional)
source_type
string
sensor
or
place
start_time
stringISO 8601:
YYYY-MM-DDTHH:MM:SS.sssZ
end_time
stringISO 8601
max_count
intMax results (default: 10)
includes
listExtra fields:
objectIds
,
info
vlm_verdict
string
confirmed
,
rejected
, or
unverified
bash
undefined
参数类型描述
source
字符串传感器ID或地点名称(可选)
source_type
字符串
sensor
place
start_time
字符串ISO 8601格式:
YYYY-MM-DDTHH:MM:SS.sssZ
end_time
字符串ISO 8601格式
max_count
整数最大结果数(默认值:10)
includes
列表额外字段:
objectIds
,
info
vlm_verdict
字符串
confirmed
,
rejected
, 或
unverified
bash
undefined

Recent incidents (all sensors)

近期事件(所有传感器)

-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incidents","arguments":{"max_count":10}},"id":1}'
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incidents","arguments":{"max_count":10}},"id":1}'

For a specific sensor

指定传感器的事件

-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incidents","arguments":{"source":"<sensor-id>","source_type":"sensor","max_count":20}},"id":1}'
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incidents","arguments":{"source":"<sensor-id>","source_type":"sensor","max_count":20}},"id":1}'

Confirmed (VLM-verified) only

仅已确认(VLM验证)的事件

-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incidents","arguments":{"vlm_verdict":"confirmed","max_count":10}},"id":1}'
undefined
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incidents","arguments":{"vlm_verdict":"confirmed","max_count":10}},"id":1}'
undefined

video_analytics__get_incident

video_analytics__get_incident

bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incident","arguments":{"id":"<incident-id>","includes":["objectIds","info"]}},"id":1}'
bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_incident","arguments":{"id":"<incident-id>","includes":["objectIds","info"]}},"id":1}'

video_analytics__get_sensor_ids

video_analytics__get_sensor_ids

bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_sensor_ids","arguments":{}},"id":1}'
bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_sensor_ids","arguments":{}},"id":1}'

video_analytics__get_places

video_analytics__get_places

bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_places","arguments":{}},"id":1}'
bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_places","arguments":{}},"id":1}'

video_analytics__get_fov_histogram

video_analytics__get_fov_histogram

bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_fov_histogram","arguments":{"source":"<sensor-id>","source_type":"sensor","start_time":"<ISO>","end_time":"<ISO>","object_type":"Person","bucket_count":10}},"id":1}'
bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__get_fov_histogram","arguments":{"source":"<sensor-id>","source_type":"sensor","start_time":"<ISO>","end_time":"<ISO>","object_type":"Person","bucket_count":10}},"id":1}'

video_analytics__analyze

video_analytics__analyze

analysis_type
:
max_min_incidents
,
average_speed
,
avg_num_people
,
avg_num_vehicles
bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__analyze","arguments":{"source":"<sensor-id>","source_type":"sensor","start_time":"<ISO>","end_time":"<ISO>","analysis_type":"avg_num_people"}},"id":1}'
analysis_type
可选值:
max_min_incidents
,
average_speed
,
avg_num_people
,
avg_num_vehicles
bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"video_analytics__analyze","arguments":{"source":"<sensor-id>","source_type":"sensor","start_time":"<ISO>","end_time":"<ISO>","analysis_type":"avg_num_people"}},"id":1}'

vst_sensor_list

vst_sensor_list

bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"vst_sensor_list","arguments":{}},"id":1}'
bash
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"vst_sensor_list","arguments":{}},"id":1}'