rhombus-node-mcp
Version:
MCP server for Rhombus API
83 lines (82 loc) • 3.26 kB
JavaScript
import { z } from "zod";
import { ISOTimestampFormatDescription } from "../utils/timestampInput.js";
import { INCLUDE_FIELDS_ARG, FILTER_BY_ARG } from "../util.js";
export var SearchToolRequestType;
(function (SearchToolRequestType) {
SearchToolRequestType["LICENSE_PLATE"] = "license-plate";
SearchToolRequestType["OBJECT_BY_COLOR"] = "object-by-color";
SearchToolRequestType["OBJECT_BY_TEXT"] = "object-by-text";
SearchToolRequestType["MOTION_SEARCH"] = "motion-search";
})(SearchToolRequestType || (SearchToolRequestType = {}));
export const TOOL_ARGS = {
requestType: z.nativeEnum(SearchToolRequestType).describe("The type of search to perform."),
query: z
.string()
.nullable()
.describe("The search query string. Required for 'license-plate' (plate number), 'object-by-text' (text description of object), 'object-by-color' (color name)."),
cameraUuid: z
.string()
.nullable()
.describe("The UUID of the camera to search. Required for 'motion-search' and 'object-by-color'."),
startTime: z
.string()
.datetime({ message: "Invalid datetime string. Expected ISO 8601 format.", offset: true })
.nullable()
.describe("Start time for the search range." + ISOTimestampFormatDescription),
endTime: z
.string()
.datetime({ message: "Invalid datetime string. Expected ISO 8601 format.", offset: true })
.nullable()
.describe("End time for the search range." + ISOTimestampFormatDescription),
deviceUuids: z
.array(z.string())
.nullable()
.describe("Optional list of device UUIDs to filter search results."),
locationUuids: z
.array(z.string())
.nullable()
.describe("Optional list of location UUIDs to filter search results."),
timeZone: z
.string()
.nullable()
.describe("The timezone for formatting timestamps."),
includeFields: INCLUDE_FIELDS_ARG,
filterBy: FILTER_BY_ARG,
};
const TOOL_ARGS_SCHEMA = z.object(TOOL_ARGS);
export const OUTPUT_SCHEMA = z.object({
licensePlateResults: z
.array(z.object({
licensePlate: z.string().optional(),
deviceUuid: z.string().optional(),
timestampMs: z.number().optional(),
confidence: z.number().optional(),
}))
.optional()
.describe("License plate search results"),
objectColorResults: z
.array(z.object({
deviceUuid: z.string().optional(),
timestampMs: z.number().optional(),
objectType: z.string().optional(),
color: z.string().optional(),
}))
.optional()
.describe("Object color search results"),
objectTextResults: z
.array(z.object({
deviceUuid: z.string().optional(),
timestampMs: z.number().optional(),
score: z.number().optional(),
}))
.optional()
.describe("Object text search results"),
motionResults: z
.array(z.object({
timestampMs: z.number().optional(),
motionScore: z.number().optional(),
}))
.optional()
.describe("Motion search results"),
error: z.string().optional().describe("An error message if the request failed."),
});