Skip to main content
Glama
vandreus

UniFi MCP Server

by vandreus

set_camera_recording

Start or stop video recording on UniFi cameras to monitor security footage and manage surveillance activities.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'set_camera_recording'. Implements confirmation logic, invokes the UniFi client function, and formats the response.
    handler: async ({ hostId, cameraId, mode, confirm }) => { if (!confirm) { return { content: [{ type: 'text', text: `Recording mode change cancelled. Set confirm=true to change recording mode to "${mode}".` }] }; } const result = await unifi.setCameraRecording(hostId, cameraId, mode); return { content: [{ type: 'text', text: `Camera recording mode set to "${mode}". ${JSON.stringify(result, null, 2)}` }] }; }
  • Zod schema defining input parameters for the tool: hostId, cameraId, mode (enum: always/motion/never), and confirm flag.
    schema: z.object({ hostId: z.string().describe('The host ID'), cameraId: z.string().describe('The camera ID'), mode: z.enum(['always', 'motion', 'never']).describe('Recording mode: always, motion-only, or never'), confirm: z.boolean().describe('Confirm this action') }),
  • Registration of the 'set_camera_recording' tool within the protectTools object, including description, schema, and handler.
    set_camera_recording: { description: 'Set the recording mode for a camera', schema: z.object({ hostId: z.string().describe('The host ID'), cameraId: z.string().describe('The camera ID'), mode: z.enum(['always', 'motion', 'never']).describe('Recording mode: always, motion-only, or never'), confirm: z.boolean().describe('Confirm this action') }), handler: async ({ hostId, cameraId, mode, confirm }) => { if (!confirm) { return { content: [{ type: 'text', text: `Recording mode change cancelled. Set confirm=true to change recording mode to "${mode}".` }] }; } const result = await unifi.setCameraRecording(hostId, cameraId, mode); return { content: [{ type: 'text', text: `Camera recording mode set to "${mode}". ${JSON.stringify(result, null, 2)}` }] }; } },
  • Helper function in UniFi client that makes the actual API call to patch the camera's recording settings.
    export async function setCameraRecording(hostId, cameraId, mode) { const response = await cloudApi.patch(`/v1/hosts/${hostId}/cameras/${cameraId}`, { recordingSettings: { mode } }); return response.data; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vandreus/Unifi-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server