UNPKG

rhombus-node-mcp

Version:
121 lines (120 loc) 5.33 kB
import { z } from "zod"; import { INCLUDE_FIELDS_ARG, FILTER_BY_ARG } from "../util.js"; export var AccessControlRequestType; (function (AccessControlRequestType) { AccessControlRequestType["UNLOCK_DOOR"] = "unlock-door"; AccessControlRequestType["GET_GROUPS"] = "get-groups"; AccessControlRequestType["GET_CREDENTIALS_BY_USER"] = "get-credentials-by-user"; AccessControlRequestType["GET_LOCKDOWN_PLANS"] = "get-lockdown-plans"; AccessControlRequestType["ACTIVATE_LOCKDOWN"] = "activate-lockdown"; AccessControlRequestType["DEACTIVATE_LOCKDOWN"] = "deactivate-lockdown"; AccessControlRequestType["GET_DOOR_SCHEDULES"] = "get-door-schedules"; AccessControlRequestType["GET_ACCESS_GRANTS"] = "get-access-grants"; AccessControlRequestType["GET_REMOTE_UNLOCK_USERS"] = "get-remote-unlock-users"; })(AccessControlRequestType || (AccessControlRequestType = {})); export const TOOL_ARGS = { requestType: z.nativeEnum(AccessControlRequestType).describe("The type of access control request to make."), doorUuid: z .string() .nullable() .describe("The UUID of the access controlled door. Required for 'unlock-door'."), userUuid: z .string() .nullable() .describe("The UUID of the user. Required for 'get-credentials-by-user'."), locationUuid: z .string() .nullable() .describe("The UUID of the location. Required for 'activate-lockdown', 'deactivate-lockdown', 'get-door-schedules', and 'get-remote-unlock-users'. Optional for 'get-access-grants' to filter by location."), lockdownPlanUuid: z .string() .nullable() .describe("The UUID of the lockdown plan. Required for 'activate-lockdown' and 'deactivate-lockdown'."), includeFields: INCLUDE_FIELDS_ARG, filterBy: FILTER_BY_ARG, }; const TOOL_ARGS_SCHEMA = z.object(TOOL_ARGS); export const OUTPUT_SCHEMA = z.object({ unlockResult: z .object({ success: z.boolean().optional(), doorUuid: z.string().optional(), }) .optional() .describe("Result of unlocking a door"), accessControlGroups: z .array(z.object({ uuid: z.string().optional(), name: z.string().optional(), description: z.string().optional(), orgUuid: z.string().optional(), userUuids: z.array(z.string()).optional(), })) .optional() .describe("List of access control groups"), credentials: z .array(z.object({ uuid: z.string().optional(), userUuid: z.string().optional(), credentialType: z.string().optional(), status: z.string().optional(), note: z.string().optional(), })) .optional() .describe("List of access control credentials for a user"), lockdownPlans: z .array(z.object({ uuid: z.string().optional(), name: z.string().optional(), locationUuid: z.string().optional(), description: z.string().optional(), active: z.boolean().optional(), })) .optional() .describe("List of lockdown plans"), lockdownResult: z .object({ success: z.boolean().optional(), locationUuid: z.string().optional(), action: z.string().optional(), }) .optional() .describe("Result of activating or deactivating a lockdown"), doorScheduleExceptions: z .array(z.object({ uuid: z.string().optional(), name: z.string().optional(), startTime: z.number().optional(), endTime: z.number().optional(), doorUuids: z.array(z.string()).optional(), })) .optional() .describe("Door schedule exceptions"), accessGrants: z .array(z.object({ uuid: z.string().optional(), name: z.string().optional(), locationUuid: z.string().optional(), userUuids: z.array(z.string()).optional(), groupUuids: z.array(z.string()).optional(), doorUuids: z.array(z.string()).optional(), scheduleUuid: z.string().optional(), })) .optional() .describe("List of location access grants. Each grant contains userUuids and groupUuids that have access to the doorUuids in the grant."), remoteUnlockUsers: z .object({ doors: z.array(z.string()).optional().describe("Names of doors with remote unlock enabled at this location."), totalUsers: z.number().optional().describe("Total number of unique users who can remotely unlock doors."), groups: z.array(z.object({ permissionGroup: z.string().optional().describe("Name of the permission group/role."), doors: z.union([z.literal("all"), z.array(z.string())]).optional() .describe("Which doors users in this group can unlock. 'all' means every door at the location."), users: z.array(z.string()).optional() .describe("Users in this group, formatted as 'Name (email)'. Always list ALL users completely."), })).optional(), }) .optional() .describe("Users who can remotely unlock doors at a location, grouped by permission group. Always present the COMPLETE list of all users to the end user."), error: z.string().optional().describe("An error message if the request failed."), });