reconnect_client
Reconnect a client device to the UniFi network to restore connectivity or apply configuration changes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/clients.js:100-105 (handler)MCP tool handler for 'reconnect_client'. Calls the underlying unifi.reconnectClient API and formats the response as MCP content.handler: async ({ hostId, siteId, mac }) => { const result = await unifi.reconnectClient(hostId, siteId, mac); return { content: [{ type: 'text', text: `Client ${mac} has been reconnected. ${JSON.stringify(result, null, 2)}` }] }; }
- src/tools/clients.js:95-99 (schema)Zod schema defining the input parameters for the 'reconnect_client' tool: hostId, siteId, and mac.schema: z.object({ hostId: z.string().describe('The host ID'), siteId: z.string().describe('The site ID'), mac: z.string().describe('The client MAC address') }),
- src/server.js:28-32 (registration)Registration of the clientTools module (which includes 'reconnect_client') to the MCP server using the dynamic registerToolsFromModule function.registerToolsFromModule(networkTools); registerToolsFromModule(deviceTools); registerToolsFromModule(clientTools); registerToolsFromModule(protectTools); registerToolsFromModule(accessTools);
- src/unifi-client.js:169-172 (helper)Core helper function implementing the UniFi API call to reconnect a client. Called by the tool handler.export async function reconnectClient(hostId, siteId, mac) { const response = await cloudApi.post(`/v1/hosts/${hostId}/sites/${siteId}/clients/${mac}/reconnect`); return response.data; }
- src/server.js:16-25 (registration)Helper function that dynamically registers all tools from a module (like clientTools containing 'reconnect_client') by extracting name, schema, handler, and description.const registerToolsFromModule = (toolsModule) => { Object.entries(toolsModule).forEach(([name, toolConfig]) => { server.tool( name, toolConfig.schema, toolConfig.handler, { description: toolConfig.description } ); }); };