get_devices_for_host
Retrieve all network devices connected to a specific host in UniFi infrastructure for monitoring and management purposes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/unifi-client.js:97-100 (handler)Core implementation of getDevicesForHost that fetches devices via UniFi Cloud APIexport async function getDevicesForHost(hostId) { const response = await cloudApi.get(`/v1/hosts/${hostId}/devices`); return response.data; }
- src/tools/devices.js:25-30 (handler)MCP tool handler wrapper that invokes the core function and formats the MCP responsehandler: async ({ hostId }) => { const devices = await unifi.getDevicesForHost(hostId); return { content: [{ type: 'text', text: JSON.stringify(devices, null, 2) }] }; }
- src/tools/devices.js:22-24 (schema)Input schema using Zod for validating hostId parameterschema: z.object({ hostId: z.string().describe('The host ID') }),
- src/tools/devices.js:20-31 (registration)Tool definition and registration within deviceTools objectget_devices_for_host: { description: 'Get all devices for a specific host', schema: z.object({ hostId: z.string().describe('The host ID') }), handler: async ({ hostId }) => { const devices = await unifi.getDevicesForHost(hostId); return { content: [{ type: 'text', text: JSON.stringify(devices, null, 2) }] }; } },
- src/server.js:29-29 (registration)Registers all tools from deviceTools module to the MCP serverregisterToolsFromModule(deviceTools);