rhombus-node-mcp 0.1.30 โ†’ 0.1.31

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 CHANGED
@@ -145,6 +145,38 @@ We've written a script that you can run to get kickstarted on developing a new t
145
145
  npm run create:tool
146
146
  ```
147
147
 
148
+ ## ๐Ÿงช Running Tests
149
+
150
+ Tests are written with [Vitest](https://vitest.dev/) and live alongside source files as `*.test.ts`.
151
+
152
+ ### 1. Set Up Your Test Environment
153
+
154
+ Copy the template and fill in your values:
155
+
156
+ ```bash
157
+ cp .env.test.template .env.test
158
+ ```
159
+
160
+ Then edit `.env.test`:
161
+
162
+ | Variable | Description |
163
+ |---|---|
164
+ | `RHOMBUS_API_KEY` | Your Rhombus API key โ€” generate one at [API Management](https://console.rhombus.com/settings/api-management) |
165
+ | `API_HOSTNAME` | API base URL โ€” defaults to `https://api.rhombus.com` (override for staging/dev) |
166
+ | `CAMERA_UUID` | UUID of a camera in your org to use for integration tests |
167
+
168
+ > `.env.test` is gitignored โ€” never commit real credentials.
169
+
170
+ ### 2. Run the Tests
171
+
172
+ ```bash
173
+ # Run all tests once
174
+ npm test
175
+
176
+ # Watch mode โ€” re-runs on file changes
177
+ npm run test:watch
178
+ ```
179
+
148
180
  ## Hitting a Snag? We've Got You! ๐Ÿ›Ÿ
149
181
 
150
182
  Check out Claude's fantastic [troubleshooting guide](https://modelcontextprotocol.io/docs/tools/debugging) for quick fixes! Still stuck? Our team of experts is ready to help!
@@ -34,9 +34,9 @@ export async function getImageForCameraAtTime(cameraUuid, timestampMs, requestMo
34
34
  headers: requestHeaders,
35
35
  }).then(async (res) => {
36
36
  if (!res.ok) {
37
- logger.error(`Failed to fetch image: ${await res.text()}`);
37
+ logger.error(`Failed to fetch image (HTTP ${res.status}): ${await res.text()}`);
38
38
  logger.error(res);
39
- return null;
39
+ return res.status === 404 ? 404 : null;
40
40
  }
41
41
  const arrayBuffer = await res.arrayBuffer();
42
42
  const buffer = Buffer.from(arrayBuffer);
@@ -51,6 +51,14 @@ export async function getImageForCameraAtTime(cameraUuid, timestampMs, requestMo
51
51
  status: "failed to fetch image",
52
52
  };
53
53
  }
54
+ if (base64Image === 404) {
55
+ return {
56
+ success: false,
57
+ status: "failed to fetch image",
58
+ message: "Camera snapshot unavailable: this camera has no recorded video (VOD) at the requested time. " +
59
+ "It may not have any footage stored, or the requested timestamp may be outside its retention window.",
60
+ };
61
+ }
54
62
  return {
55
63
  success: true,
56
64
  status: "successfully fetched image",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhombus-node-mcp",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "MCP server for Rhombus API",
5
5
  "keywords": [
6
6
  "ai",
@@ -31,6 +31,8 @@
31
31
  "start:http": "TRANSPORT_TYPE=streamable-http node dist/index.js",
32
32
  "start:stdio": "TRANSPORT_TYPE=stdio node dist/index.js",
33
33
  "prepare": "npm run build",
34
+ "test": "vitest run",
35
+ "test:watch": "vitest",
34
36
  "watch": "npm run clean && tsc --watch",
35
37
  "generate-schemas": "npx tsx scripts/generate-zod-schemas.ts",
36
38
  "scrape-sitemaps": "npx tsx scripts/scrape-sitemaps.ts",
@@ -73,7 +75,8 @@
73
75
  "openapi-typescript-codegen": "^0.29.0",
74
76
  "openapi-zod-client": "^1.17.0",
75
77
  "prettier": "3.5.3",
76
- "typescript": "^5.8.3"
78
+ "typescript": "^5.8.3",
79
+ "vitest": "^4.1.4"
77
80
  },
78
81
  "engines": {
79
82
  "node": ">=18"