rhombus-node-mcp 0.1.13 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/api/camera-tool-api.js +108 -0
- package/dist/api/clips-tool-api.js +36 -0
- package/dist/api/create-camera-policy-tool-api.js +9 -0
- package/dist/api/create-tool-api.js +53 -0
- package/dist/api/entity-lookup-tool-api.js +37 -0
- package/dist/api/events-tool-api.js +320 -0
- package/dist/api/faces-tool-api.js +110 -0
- package/dist/api/get-entity-tool-api.js +176 -0
- package/dist/api/get-org-information-tool-api.js +9 -0
- package/dist/api/location-tool-api.js +9 -0
- package/dist/api/lpr-tool-api.js +68 -0
- package/dist/api/policy-alerts-tool-api.js +42 -0
- package/dist/api/reboot-cameras-tool-api.js +34 -0
- package/dist/api/report-tool-api.js +426 -0
- package/dist/api/time-tool-api.js +90 -0
- package/dist/api/update-tool-api.js +148 -0
- package/dist/createServer.js +50 -0
- package/dist/disabled-tools/endpoint-to-keys-tool.js +84 -0
- package/dist/disabled-tools/semantic-search-tool.js +90 -0
- package/dist/index.js +25 -32
- package/dist/logger.js +5 -4
- package/dist/network.js +45 -14
- package/dist/resources/routes.json.js +1 -1
- package/dist/services/embedding-service.js +153 -0
- package/dist/services/faiss-search-service.js +261 -0
- package/dist/tools/camera-tool.js +100 -0
- package/dist/tools/clips-tool.js +23 -38
- package/dist/tools/count-tool.js +25 -0
- package/dist/tools/create-camera-policy-tool.js +214 -0
- package/dist/tools/create-tool.js +25 -75
- package/dist/tools/entity-lookup-tool.js +35 -0
- package/dist/tools/events-tool.js +188 -93
- package/dist/tools/faces-tool.js +59 -133
- package/dist/tools/get-entity-tool.js +78 -0
- package/dist/tools/get-org-information-tool.js +18 -0
- package/dist/tools/location-tool.js +24 -32
- package/dist/tools/lpr-tool.js +71 -0
- package/dist/tools/policy-alerts-tool.js +32 -43
- package/dist/tools/reboot-cameras-tool.js +34 -0
- package/dist/tools/report-tool.js +190 -0
- package/dist/tools/time-conversion-tool.js +43 -0
- package/dist/tools/time-tool.js +17 -55
- package/dist/tools/update-tool.js +262 -0
- package/dist/transports/stdio.js +10 -0
- package/dist/transports/streamable-http.js +201 -0
- package/dist/{tools/devices/camera-tool/types.js → types/camera-tool-types.js} +13 -0
- package/dist/types/clips-tool-types.js +41 -0
- package/dist/types/create-camera-policy-tool-types.js +44 -0
- package/dist/types/create-tool-types.js +8 -0
- package/dist/types/deviceType.js +1 -0
- package/dist/types/endpoint-to-keys-tool-types.js +7 -0
- package/dist/types/entity-lookup-tool-types.js +70 -0
- package/dist/types/events-tools-types.js +257 -0
- package/dist/types/faces-tools-types.js +143 -0
- package/dist/types/get-entity-tool-types.js +25 -0
- package/dist/types/get-org-information-tool-types.js +3 -0
- package/dist/types/location-tool-types.js +11 -0
- package/dist/types/lpr-tool-types.js +97 -0
- package/dist/types/policy-alerts-tool-types.js +74 -0
- package/dist/types/reboot-cameras-tool-types.js +8 -0
- package/dist/types/report-tool-types.js +268 -0
- package/dist/types/schema-components.js +7093 -0
- package/dist/types/schema.js +1 -0
- package/dist/types/semantic-search-tool-types.js +5 -0
- package/dist/types/time-conversion-tool-types.js +8 -0
- package/dist/types/time-tool-types.js +11 -0
- package/dist/types/update-tool-types.js +186 -0
- package/dist/types/zod-schemas.js +21315 -0
- package/dist/types.js +17 -7
- package/dist/util.js +96 -14
- package/dist/utils/confirmation.js +1 -7
- package/dist/utils/reduce-output.js +35 -0
- package/dist/utils/remove-nulls.js +28 -0
- package/dist/utils/temp.js +8 -0
- package/dist/utils/timestampInput.js +12 -0
- package/package.json +28 -3
- package/dist/tools/devices/camera-tool/camera-tool.js +0 -218
- package/dist/tools/devices/get-entity-tool.js +0 -117
- package/dist/tools/get-org-information.js +0 -18
- package/dist/tools/reboot-cameras.js +0 -63
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { postApi } from "../../network.js";
|
|
3
|
-
import { createToolArgs, createToolTextContent } from "../../util.js";
|
|
4
|
-
import DeviceType from "../../types/deviceType.js";
|
|
5
|
-
async function getCameraList(requestModifiers) {
|
|
6
|
-
return {
|
|
7
|
-
cameras: (await postApi("/camera/getMinimalCameraStateList", "{}", requestModifiers)).cameraStates.filter((camera) => !!camera.locationUuid),
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
async function getDoorbellCameras(requestModifiers) {
|
|
11
|
-
return {
|
|
12
|
-
doorbellCameras: (await postApi("/doorbellcamera/getMinimalStateList", "{}", requestModifiers)).minimalStates.filter((doorbellCamera) => !!doorbellCamera.locationUuid),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
async function getBadgeReaders(requestModifiers) {
|
|
16
|
-
return await postApi("/badgereader/getMinimalStateList", "{}", requestModifiers).then(response => {
|
|
17
|
-
return {
|
|
18
|
-
badgeReaders: response.minimalStates.filter((badgeReader) => !!badgeReader.locationUuid),
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
async function getAccessControlledDoors(requestModifiers) {
|
|
23
|
-
return await postApi("/component/findAccessControlledDoors", "{}", requestModifiers);
|
|
24
|
-
}
|
|
25
|
-
async function getAudioGateways(requestModifiers) {
|
|
26
|
-
return await postApi("/audiogateway/getMinimalAudioGatewayStateList", "{}", requestModifiers).then(response => {
|
|
27
|
-
return {
|
|
28
|
-
audioGateways: response.audioGatewayStates.filter((camera) => !!camera.locationUuid),
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async function getDoorSensors(requestModifiers) {
|
|
33
|
-
return await postApi("/door/getMinimalDoorStateList", "{}", requestModifiers).then(response => {
|
|
34
|
-
return {
|
|
35
|
-
doorStates: response.doorStates.filter((door) => !!door.locationUuid),
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
async function getEnvironmentalSensors(requestModifiers) {
|
|
40
|
-
return await postApi("/climate/getMinimalClimateStateList", "{}", requestModifiers).then(response => {
|
|
41
|
-
return {
|
|
42
|
-
climateStates: response.climateStates.filter((sensor) => !!sensor.locationUuid),
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
async function getMotionSensors(requestModifiers) {
|
|
47
|
-
return await postApi("/occupancy/getMinimalOccupancySensorStateList", "{}", requestModifiers).then(response => {
|
|
48
|
-
return {
|
|
49
|
-
occupancySensorStates: response.occupancySensorStates.filter((occupancySensor) => !!occupancySensor.locationUuid),
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
async function getButtons(requestModifiers) {
|
|
54
|
-
return await postApi("/button/getMinimalButtonStateList", "{}", requestModifiers).then(response => {
|
|
55
|
-
return {
|
|
56
|
-
buttonStates: response.states.filter((button) => !!button.locationUuid),
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
async function getKeypads(requestModifiers) {
|
|
61
|
-
return await postApi("/keypad/getKeypadsForOrg", "{}", requestModifiers).then(response => {
|
|
62
|
-
return {
|
|
63
|
-
keypadStates: response.keypads.filter((keypad) => !!keypad.locationUuid),
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
export function createTool(server) {
|
|
68
|
-
server.tool("get-entity-tool", `
|
|
69
|
-
Retrieves entities (or devices) of certain types.
|
|
70
|
-
Can request multiple entity types at once.
|
|
71
|
-
The return structure is a JSON string that continues the states of the requested entities.
|
|
72
|
-
This data is exact. Whatever entities exist will be returned here.`, createToolArgs({
|
|
73
|
-
entityTypes: z
|
|
74
|
-
.array(z.nativeEnum(DeviceType).describe("The entity type to retreive"))
|
|
75
|
-
.describe("What type of entities to retrieve."),
|
|
76
|
-
}), async ({ entityTypes, requestModifiers }) => {
|
|
77
|
-
const promises = [];
|
|
78
|
-
if (entityTypes.includes(DeviceType.CAMERA)) {
|
|
79
|
-
promises.push(getCameraList(requestModifiers));
|
|
80
|
-
}
|
|
81
|
-
if (entityTypes.includes(DeviceType.DOORBELL_CAMERA)) {
|
|
82
|
-
promises.push(getDoorbellCameras(requestModifiers));
|
|
83
|
-
}
|
|
84
|
-
if (entityTypes.includes(DeviceType.BADGE_READER)) {
|
|
85
|
-
promises.push(getBadgeReaders(requestModifiers));
|
|
86
|
-
}
|
|
87
|
-
if (entityTypes.includes(DeviceType.ACCESS_CONTROL_DOOR)) {
|
|
88
|
-
promises.push(getAccessControlledDoors(requestModifiers));
|
|
89
|
-
}
|
|
90
|
-
if (entityTypes.includes(DeviceType.AUDIO_GATEWAY)) {
|
|
91
|
-
promises.push(getAudioGateways(requestModifiers));
|
|
92
|
-
}
|
|
93
|
-
if (entityTypes.includes(DeviceType.DOOR_SENSOR)) {
|
|
94
|
-
promises.push(getDoorSensors(requestModifiers));
|
|
95
|
-
}
|
|
96
|
-
if (entityTypes.includes(DeviceType.ENVIRONMENTAL_SENSOR)) {
|
|
97
|
-
promises.push(getEnvironmentalSensors(requestModifiers));
|
|
98
|
-
}
|
|
99
|
-
if (entityTypes.includes(DeviceType.MOTION_SENSOR)) {
|
|
100
|
-
promises.push(getMotionSensors(requestModifiers));
|
|
101
|
-
}
|
|
102
|
-
if (entityTypes.includes(DeviceType.BUTTON)) {
|
|
103
|
-
promises.push(getButtons(requestModifiers));
|
|
104
|
-
}
|
|
105
|
-
if (entityTypes.includes(DeviceType.KEYPAD)) {
|
|
106
|
-
promises.push(getKeypads(requestModifiers));
|
|
107
|
-
}
|
|
108
|
-
const responses = Promise.all(promises);
|
|
109
|
-
const ret = {
|
|
110
|
-
...(await responses).reduce((prev, curr) => ({
|
|
111
|
-
...prev,
|
|
112
|
-
...curr
|
|
113
|
-
}), {})
|
|
114
|
-
};
|
|
115
|
-
return createToolTextContent(JSON.stringify(ret));
|
|
116
|
-
});
|
|
117
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { createToolArgs } from "../util.js";
|
|
2
|
-
import { postApi } from "../network.js";
|
|
3
|
-
async function getOrg(requestModifiers) {
|
|
4
|
-
return await postApi("/org/getOrgV2", {}, requestModifiers);
|
|
5
|
-
}
|
|
6
|
-
export function createTool(server) {
|
|
7
|
-
server.tool("get-org-information", "Get general information about the organization including org name, camera configuration defaults, contact information, and org settings.", createToolArgs({}), async ({ requestModifiers }) => {
|
|
8
|
-
const org = await getOrg(requestModifiers);
|
|
9
|
-
return {
|
|
10
|
-
content: [
|
|
11
|
-
{
|
|
12
|
-
type: "text",
|
|
13
|
-
text: JSON.stringify(org),
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { createToolArgs } from "../util.js";
|
|
3
|
-
import { postApi } from "../network.js";
|
|
4
|
-
import { addConfirmationParams, isConfirmed, requireConfirmation } from "../utils/confirmation.js";
|
|
5
|
-
async function rebootCameras(cameraUuids, requestModifiers) {
|
|
6
|
-
let successCount = 0;
|
|
7
|
-
let errorCount = 0;
|
|
8
|
-
for (const cameraUuid in cameraUuids) {
|
|
9
|
-
try {
|
|
10
|
-
const body = { cameraUuid };
|
|
11
|
-
const response = await postApi("/camera/reboot", body, requestModifiers);
|
|
12
|
-
if (response.error) {
|
|
13
|
-
errorCount++;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
successCount++;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
const ret = `Error rebooting cameras: ${error}`;
|
|
21
|
-
return { error: true, status: ret };
|
|
22
|
-
}
|
|
23
|
-
let status;
|
|
24
|
-
if (successCount === cameraUuids.length)
|
|
25
|
-
status = "SUCCESS";
|
|
26
|
-
else if (successCount > 0 && successCount < cameraUuids.length)
|
|
27
|
-
status = "PARTIAL_SUCCESS";
|
|
28
|
-
else
|
|
29
|
-
status = "ERROR";
|
|
30
|
-
return { status, successCount, errorCount };
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export function createTool(server) {
|
|
34
|
-
server.tool("reboot-cameras", "this tool is for rebooting one or more cameras causing them to reconnect to the server, this is a helpful option when a camera is experiencing connectivity issues or is in need of troubleshooting. THIS TOOL PERFORMS AN ACTION.", addConfirmationParams(createToolArgs({
|
|
35
|
-
cameraUuids: z
|
|
36
|
-
.array(z.string())
|
|
37
|
-
.describe("An array of camera UUID strings which are unique identifiers for cameras"),
|
|
38
|
-
})), async ({ cameraUuids, requestModifiers, confirmationId }) => {
|
|
39
|
-
const confirmation = requireConfirmation(confirmationId);
|
|
40
|
-
if (!isConfirmed(confirmation)) {
|
|
41
|
-
return confirmation;
|
|
42
|
-
}
|
|
43
|
-
const cameraRebootData = await rebootCameras(cameraUuids, requestModifiers);
|
|
44
|
-
if (!cameraRebootData) {
|
|
45
|
-
return {
|
|
46
|
-
content: [
|
|
47
|
-
{
|
|
48
|
-
type: "text",
|
|
49
|
-
text: "Failed to reboot cameras",
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
content: [
|
|
56
|
-
{
|
|
57
|
-
type: "text",
|
|
58
|
-
text: JSON.stringify(cameraRebootData),
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
}
|