set_camera_privacy
Control camera privacy settings to enable or disable video recording and streaming for UniFi Protect cameras.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.js:28-32 (registration)Registration of the protectTools module (containing set_camera_privacy) into the MCP server via registerToolsFromModuleregisterToolsFromModule(networkTools); registerToolsFromModule(deviceTools); registerToolsFromModule(clientTools); registerToolsFromModule(protectTools); registerToolsFromModule(accessTools);
- src/tools/protect.js:48-64 (handler)The MCP tool handler for 'set_camera_privacy'. It checks confirmation and delegates to unifi.setCameraPrivacyhandler: async ({ hostId, cameraId, enabled, confirm }) => { if (!confirm) { return { content: [{ type: 'text', text: `Privacy mode change cancelled. Set confirm=true to ${enabled ? 'enable' : 'disable'} privacy mode.` }] }; } const result = await unifi.setCameraPrivacy(hostId, cameraId, enabled); return { content: [{ type: 'text', text: `Camera privacy mode ${enabled ? 'enabled' : 'disabled'}. ${JSON.stringify(result, null, 2)}` }] }; }
- src/tools/protect.js:42-47 (schema)Zod input schema definition for the set_camera_privacy toolschema: z.object({ hostId: z.string().describe('The host ID'), cameraId: z.string().describe('The camera ID'), enabled: z.boolean().describe('Enable or disable privacy mode'), confirm: z.boolean().describe('Confirm this action') }),
- src/unifi-client.js:229-234 (helper)Low-level helper function that calls the UniFi Cloud API to set camera privacy modeexport async function setCameraPrivacy(hostId, cameraId, enabled) { const response = await cloudApi.patch(`/v1/hosts/${hostId}/cameras/${cameraId}`, { privacyMode: enabled }); return response.data; }