rhombus-node-mcp 0.1.56 → 0.1.57

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.
Files changed (102) hide show
  1. package/dist/api/access-control-tool-api.js +231 -32
  2. package/dist/api/alarm-monitoring-tool-api.js +50 -1
  3. package/dist/api/automated-prompts-tool-api.js +9 -17
  4. package/dist/api/camera-policy-tool-api.js +122 -0
  5. package/dist/api/camera-tool-api.js +3 -5
  6. package/dist/api/camera-uptime-tool-api.js +62 -25
  7. package/dist/api/clips-tool-api.js +45 -9
  8. package/dist/api/create-tool-api.js +55 -7
  9. package/dist/api/door-tool-api.js +74 -13
  10. package/dist/api/entity-lookup-tool-api.js +8 -1
  11. package/dist/api/events-tool-api.js +79 -6
  12. package/dist/api/faces-tool-api.js +112 -7
  13. package/dist/api/get-accessible-apps.js +68 -6
  14. package/dist/api/get-entity-tool-api.js +12 -12
  15. package/dist/api/get-org-information-tool-api.js +2 -2
  16. package/dist/api/guest-management-tool-api.js +75 -1
  17. package/dist/api/location-tool-api.js +120 -28
  18. package/dist/api/lpr-tool-api.js +71 -16
  19. package/dist/api/policy-alerts-tool-api.js +7 -3
  20. package/dist/api/report-tool-api.js +4 -1
  21. package/dist/api/rules-tool-api.js +6 -16
  22. package/dist/api/schedule-tool-api.js +107 -0
  23. package/dist/api/search-tool-api.js +5 -13
  24. package/dist/api/update-tool-api.js +96 -1
  25. package/dist/api/user-tool-api.js +58 -13
  26. package/dist/createServer.js +18 -6
  27. package/dist/filtering-utils.js +421 -29
  28. package/dist/index.js +1 -1
  29. package/dist/network/network.js +122 -10
  30. package/dist/network/org-reference-cache.js +74 -0
  31. package/dist/telemetry/tracingProxy.js +4 -0
  32. package/dist/tools/entity-lookup-tool.js +6 -4
  33. package/dist/tools/get-entity-tool.js +40 -20
  34. package/dist/tools/get-org-information-tool.js +30 -2
  35. package/dist/tools/time-conversion-tool.js +59 -36
  36. package/dist/tools/time-tool.js +12 -3
  37. package/dist/tools/user-tool.js +100 -2
  38. package/dist/tools-console/access-anomaly-tool.js +2 -19
  39. package/dist/tools-console/access-control-tool.js +328 -2
  40. package/dist/tools-console/alarm-monitoring-tool.js +72 -2
  41. package/dist/tools-console/analytics-tool.js +2 -2
  42. package/dist/tools-console/badge-timeline-tool.js +2 -21
  43. package/dist/tools-console/camera-policy-tool.js +252 -0
  44. package/dist/tools-console/camera-tool.js +111 -89
  45. package/dist/tools-console/clips-tool.js +21 -31
  46. package/dist/tools-console/count-tool.js +8 -0
  47. package/dist/tools-console/create-camera-policy-tool.js +302 -122
  48. package/dist/tools-console/door-schedule-exception-tool.js +2 -33
  49. package/dist/tools-console/door-tool.js +130 -2
  50. package/dist/tools-console/elements-access-anomaly-tool.js +2 -19
  51. package/dist/tools-console/elements-badge-timeline-tool.js +2 -21
  52. package/dist/tools-console/elements-lost-badge-tool.js +2 -17
  53. package/dist/tools-console/elements-tool.js +2 -29
  54. package/dist/tools-console/events-tool.js +22 -101
  55. package/dist/tools-console/faces-tool.js +254 -28
  56. package/dist/tools-console/guest-management-tool.js +127 -2
  57. package/dist/tools-console/location-tool.js +156 -35
  58. package/dist/tools-console/lost-badge-tool.js +2 -17
  59. package/dist/tools-console/lpr-tool.js +89 -23
  60. package/dist/tools-console/netbox-access-anomaly-tool.js +2 -19
  61. package/dist/tools-console/netbox-badge-timeline-tool.js +2 -21
  62. package/dist/tools-console/netbox-lost-badge-tool.js +2 -17
  63. package/dist/tools-console/netbox-tool.js +2 -29
  64. package/dist/tools-console/onguard-tool.js +2 -30
  65. package/dist/tools-console/person-tracking-tool.js +2 -2
  66. package/dist/tools-console/policy-alerts-tool.js +5 -29
  67. package/dist/tools-console/reboot-cameras-tool.js +17 -2
  68. package/dist/tools-console/report-tool.js +10 -40
  69. package/dist/tools-console/schedule-tool.js +190 -0
  70. package/dist/tools-console/update-tool.js +298 -168
  71. package/dist/tools-console/video-walls-tool.js +93 -21
  72. package/dist/types/access-anomaly-tool-types.js +22 -2
  73. package/dist/types/access-control-tool-types.js +116 -1
  74. package/dist/types/alarm-monitoring-tool-types.js +42 -1
  75. package/dist/types/badge-timeline-tool-types.js +18 -3
  76. package/dist/types/camera-policy-tool-types.js +104 -0
  77. package/dist/types/camera-tool-types.js +80 -1
  78. package/dist/types/clips-tool-types.js +27 -3
  79. package/dist/types/create-camera-policy-tool-types.js +275 -26
  80. package/dist/types/door-schedule-exception-tool-types.js +20 -6
  81. package/dist/types/door-tool-types.js +36 -4
  82. package/dist/types/entity-lookup-tool-types.js +6 -1
  83. package/dist/types/events-tools-types.js +24 -16
  84. package/dist/types/faces-tools-types.js +106 -3
  85. package/dist/types/get-entity-tool-types.js +76 -12
  86. package/dist/types/guest-management-tool-types.js +103 -1
  87. package/dist/types/location-tool-types.js +100 -14
  88. package/dist/types/lost-badge-tool-types.js +17 -2
  89. package/dist/types/lpr-tool-types.js +47 -8
  90. package/dist/types/onguard-tool-types.js +21 -1
  91. package/dist/types/policy-alerts-tool-types.js +1 -1
  92. package/dist/types/report-tool-types.js +29 -1
  93. package/dist/types/schedule-tool-types.js +370 -0
  94. package/dist/types/schema.js +479 -9
  95. package/dist/types/time-conversion-tool-types.js +3 -4
  96. package/dist/types/update-tool-types.js +40 -18
  97. package/dist/types/user-tool-types.js +44 -1
  98. package/dist/types/video-walls-tool-types.js +30 -2
  99. package/dist/types/zod-schemas.js +5128 -996
  100. package/dist/util.js +62 -3
  101. package/dist/utils/entity-name-match.js +11 -0
  102. package/package.json +3 -1
package/dist/util.js CHANGED
@@ -2,8 +2,8 @@ import { z } from "zod";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import { DateTime } from "luxon";
5
- import { filterIncludedFields, applyFilterBy } from "./filtering-utils.js";
6
- export { INCLUDE_FIELDS_ARG, FILTER_BY_ARG, filterIncludedFields, applyFilterBy, zodToDotNotationPaths, createFilteringProxy } from "./filtering-utils.js";
5
+ import { filterIncludedFields, applyFilterBy, applyGroupBy } from "./filtering-utils.js";
6
+ export { INCLUDE_FIELDS_ARG, FILTER_BY_ARG, GROUP_BY_ARG, filterIncludedFields, applyFilterBy, applyGroupBy, zodToDotNotationPaths, createFilteringProxy } from "./filtering-utils.js";
7
7
  export function generateRandomString(length) {
8
8
  const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
9
9
  let result = "";
@@ -61,10 +61,20 @@ export function getFilePathsInDirectory(dirPath) {
61
61
  // Tool content helpers
62
62
  // ---------------------------------------------------------------------------
63
63
  /**
64
- * Returns an object in the form expected by `server.tool`
64
+ * Returns an object in the form expected by `server.tool`, for the text-only
65
+ * results tools use to report a bad/missing argument.
66
+ *
67
+ * `isError` is REQUIRED here, not cosmetic. Every tool that calls this also
68
+ * registers an `outputSchema`, and the SDK's post-handler validation throws
69
+ * "MCP error -32602: ... no structured content was provided" for any result
70
+ * that lacks `structuredContent` — unless `isError` is set, which short-circuits
71
+ * that check (see validateToolOutput in @modelcontextprotocol/sdk server/mcp.js).
72
+ * Without it the -32602 REPLACES this text, so the model sees a protocol crash
73
+ * instead of "doorControllerUuid is required" and cannot correct its call.
65
74
  */
66
75
  export function createToolTextContent(content) {
67
76
  return {
77
+ isError: true,
68
78
  content: [
69
79
  {
70
80
  type: "text",
@@ -90,6 +100,9 @@ export function createToolStructuredContent(content, opts) {
90
100
  if (opts?.filterBy?.length) {
91
101
  result = applyFilterBy(result, opts.filterBy) ?? result;
92
102
  }
103
+ if (opts?.groupBy) {
104
+ result = applyGroupBy(result, opts.groupBy) ?? result;
105
+ }
93
106
  if (opts?.includeFields?.length) {
94
107
  result = filterIncludedFields(result, opts.includeFields) ?? result;
95
108
  }
@@ -168,6 +181,52 @@ export function formatTimestamp(timestampMs, timeZone) {
168
181
  locale: "en-US",
169
182
  });
170
183
  }
184
+ // ---------------------------------------------------------------------------
185
+ // Weekly minute intervals
186
+ // ---------------------------------------------------------------------------
187
+ const MINUTES_PER_DAY = 24 * 60;
188
+ const MINUTES_PER_WEEK = 7 * MINUTES_PER_DAY;
189
+ /**
190
+ * Rhombus weekly schedules store their windows as "minute of week" integers.
191
+ * Minute 0 is **Monday 00:00** — the order of `RhombusDayOfWeekEnum` in the
192
+ * api2 spec, which matches `java.time.DayOfWeek`.
193
+ */
194
+ const WEEKDAY_NAMES = [
195
+ "Monday",
196
+ "Tuesday",
197
+ "Wednesday",
198
+ "Thursday",
199
+ "Friday",
200
+ "Saturday",
201
+ "Sunday",
202
+ ];
203
+ /** "27000" -> "Wednesday 18:00". */
204
+ export function formatMinuteOfWeek(minuteOfWeek) {
205
+ // Negative or past-end values are normalised rather than rejected: the caller
206
+ // is rendering whatever api2 stored, and a wrapped window is legitimate.
207
+ const normalized = ((Math.trunc(minuteOfWeek) % MINUTES_PER_WEEK) + MINUTES_PER_WEEK) %
208
+ MINUTES_PER_WEEK;
209
+ const day = WEEKDAY_NAMES[Math.floor(normalized / MINUTES_PER_DAY)];
210
+ const minuteOfDay = normalized % MINUTES_PER_DAY;
211
+ const hours = String(Math.floor(minuteOfDay / 60)).padStart(2, "0");
212
+ const minutes = String(minuteOfDay % 60).padStart(2, "0");
213
+ return `${day} ${hours}:${minutes}`;
214
+ }
215
+ /**
216
+ * Human-readable form of one weekly window, e.g. "Monday 09:00 – Monday 17:00".
217
+ *
218
+ * Tools should emit this ALONGSIDE the raw `minuteOfWeekStart`/`Stop` integers,
219
+ * never instead of them: a bare 27000 is unreadable to the model, but if the
220
+ * Monday-is-day-0 convention above is ever wrong the formatted string would let
221
+ * it state the wrong day with full confidence. Keeping both makes that
222
+ * checkable.
223
+ */
224
+ export function describeWeeklyInterval(minuteOfWeekStart, minuteOfWeekStop) {
225
+ if (typeof minuteOfWeekStart !== "number" || typeof minuteOfWeekStop !== "number") {
226
+ return undefined;
227
+ }
228
+ return `${formatMinuteOfWeek(minuteOfWeekStart)} – ${formatMinuteOfWeek(minuteOfWeekStop)}`;
229
+ }
171
230
  /**
172
231
  * Formats a timestamp in milliseconds to an ISO 8601 string with timezone offset.
173
232
  * Format: "2025-04-21T10:57:00.000-07:00"
@@ -0,0 +1,11 @@
1
+ /** Match human names despite capitalization, spacing, or punctuation differences. */
2
+ export function matchesEntityName(name, query) {
3
+ const lowerName = name.toLowerCase();
4
+ const lowerQuery = query.toLowerCase();
5
+ if (lowerName.includes(lowerQuery))
6
+ return true;
7
+ const compact = (value) => value.normalize("NFKC").replace(/[^\p{L}\p{N}]/gu, "");
8
+ const compactQuery = compact(lowerQuery);
9
+ // Do not turn punctuation-only or tiny queries into broad matches.
10
+ return compactQuery.length >= 3 && compact(lowerName).includes(compactQuery);
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhombus-node-mcp",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "description": "MCP server for Rhombus API",
5
5
  "keywords": [
6
6
  "ai",
@@ -35,6 +35,7 @@
35
35
  "test:watch": "vitest",
36
36
  "watch": "npm run clean && tsc --watch",
37
37
  "generate-schemas": "npx tsx scripts/generate-zod-schemas.ts",
38
+ "generate-openapi-types": "npx tsx scripts/generate-openapi-types.ts",
38
39
  "scrape-sitemaps": "npx tsx scripts/scrape-sitemaps.ts",
39
40
  "scrape-content": "npx tsx scripts/scrape-content.ts",
40
41
  "scrape-progress": "npx tsx scripts/scrape-content.ts --progress",
@@ -70,6 +71,7 @@
70
71
  "@types/express": "^5.0.3",
71
72
  "@types/luxon": "^3.6.2",
72
73
  "@types/node": "^22.14.0",
74
+ "openapi-typescript": "^7.13.0",
73
75
  "openapi-typescript-codegen": "^0.29.0",
74
76
  "openapi-zod-client": "^1.17.0",
75
77
  "prettier": "3.5.3",