list_cameras
Retrieve a list of all cameras connected to your UniFi network for monitoring and management purposes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/protect.js:14-19 (handler)The handler function that executes the list_cameras tool logic by calling unifi.listCameras and formatting the response as JSON text.handler: async ({ hostId }) => { const cameras = await unifi.listCameras(hostId); return { content: [{ type: 'text', text: JSON.stringify(cameras, null, 2) }] }; }
- src/tools/protect.js:11-13 (schema)Zod schema defining the input parameters for the list_cameras tool: hostId (string).schema: z.object({ hostId: z.string().describe('The host ID') }),
- src/tools/protect.js:9-20 (registration)Registration of the list_cameras tool within the protectTools object, including description, schema, and handler.list_cameras: { description: 'List all UniFi Protect cameras for a host', schema: z.object({ hostId: z.string().describe('The host ID') }), handler: async ({ hostId }) => { const cameras = await unifi.listCameras(hostId); return { content: [{ type: 'text', text: JSON.stringify(cameras, null, 2) }] }; } },
- src/unifi-client.js:213-216 (helper)Supporting function listCameras that performs the actual API request to retrieve cameras for the given hostId.export async function listCameras(hostId) { const response = await cloudApi.get(`/v1/hosts/${hostId}/cameras`); return response.data; }