get_camera
Retrieve camera details and settings from UniFi network infrastructure to monitor and manage surveillance devices through the Cloud API.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_camera"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/protect.js:28-33 (handler)The MCP tool handler for 'get_camera'. Calls unifi.getCamera(hostId, cameraId) and returns formatted JSON response.
handler: async ({ hostId, cameraId }) => { const camera = await unifi.getCamera(hostId, cameraId); return { content: [{ type: 'text', text: JSON.stringify(camera, null, 2) }] }; } - src/tools/protect.js:24-27 (schema)Input validation schema for the 'get_camera' tool using Zod, requiring hostId and cameraId.
schema: z.object({ hostId: z.string().describe('The host ID'), cameraId: z.string().describe('The camera ID') }), - src/tools/protect.js:22-34 (registration)Definition of the 'get_camera' tool within the protectTools module, which is later registered in the MCP server.
get_camera: { description: 'Get details of a specific camera', schema: z.object({ hostId: z.string().describe('The host ID'), cameraId: z.string().describe('The camera ID') }), handler: async ({ hostId, cameraId }) => { const camera = await unifi.getCamera(hostId, cameraId); return { content: [{ type: 'text', text: JSON.stringify(camera, null, 2) }] }; } }, - src/server.js:31-31 (registration)Batch registration of all protectTools (including get_camera) into the MCP server via registerToolsFromModule.
registerToolsFromModule(protectTools); - src/unifi-client.js:221-224 (helper)Supporting function getCamera that performs the actual UniFi Cloud API call to retrieve specific camera details.
export async function getCamera(hostId, cameraId) { const response = await cloudApi.get(`/v1/hosts/${hostId}/cameras/${cameraId}`); return response.data; }