get_clients_for_host
Retrieve client device information connected to a specific host on your UniFi network for monitoring and management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/clients.js:25-30 (handler)The MCP tool handler that invokes the unifi.getClientsForHost helper and returns a formatted JSON response.handler: async ({ hostId }) => { const clients = await unifi.getClientsForHost(hostId); return { content: [{ type: 'text', text: JSON.stringify(clients, null, 2) }] }; }
- src/tools/clients.js:22-24 (schema)Zod schema validating the input parameter 'hostId' as a string.schema: z.object({ hostId: z.string().describe('The host ID') }),
- src/server.js:30-30 (registration)Registers the clientTools module, which includes the get_clients_for_host tool, with the MCP server.registerToolsFromModule(clientTools);
- src/unifi-client.js:133-136 (helper)Helper function that performs the actual API call to retrieve clients for a specific host from the UniFi Cloud API.export async function getClientsForHost(hostId) { const response = await cloudApi.get(`/v1/hosts/${hostId}/clients`); return response.data; }