rhombus-node-mcp
Version:
MCP server for Rhombus API
59 lines (58 loc) • 2.11 kB
JavaScript
import { z } from "zod";
export var RulesToolRequestType;
(function (RulesToolRequestType) {
RulesToolRequestType["LIST"] = "list";
RulesToolRequestType["CREATE"] = "create";
RulesToolRequestType["UPDATE"] = "update";
RulesToolRequestType["DELETE"] = "delete";
RulesToolRequestType["GET_RECORDS"] = "get-records";
})(RulesToolRequestType || (RulesToolRequestType = {}));
export const TOOL_ARGS = {
requestType: z.nativeEnum(RulesToolRequestType).describe("The type of rules operation to perform."),
ruleUuid: z
.string()
.nullable()
.describe("The UUID of the rule. Required for 'update', 'delete', and 'get-records'."),
ruleName: z
.string()
.nullable()
.describe("The name of the rule. Required for 'create'."),
ruleConfig: z
.string()
.nullable()
.describe("JSON string of the rule configuration. Required for 'create' and 'update'. Contains the rule definition."),
};
const TOOL_ARGS_SCHEMA = z.object(TOOL_ARGS);
export const OUTPUT_SCHEMA = z.object({
rules: z
.array(z.object({
uuid: z.string().optional(),
name: z.string().optional(),
enabled: z.boolean().optional(),
orgUuid: z.string().optional(),
ruleType: z.string().optional(),
createdAtMs: z.number().optional(),
updatedAtMs: z.number().optional(),
}))
.optional()
.describe("List of rules"),
rule: z
.object({
uuid: z.string().optional(),
name: z.string().optional(),
success: z.boolean().optional(),
})
.optional()
.describe("Result of create/update/delete operation"),
ruleRecords: z
.array(z.object({
uuid: z.string().optional(),
ruleUuid: z.string().optional(),
triggeredAtMs: z.number().optional(),
deviceUuid: z.string().optional(),
locationUuid: z.string().optional(),
}))
.optional()
.describe("Rule trigger event records"),
error: z.string().optional().describe("An error message if the request failed."),
});