locate_device
Find and identify UniFi network devices on your network to manage connectivity and troubleshoot issues.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/devices.js:72-80 (handler)The handler function for the locate_device tool. It calls the unifi.locateDevice helper and formats the response as MCP content.handler: async ({ hostId, deviceId, enabled }) => { const result = await unifi.locateDevice(hostId, deviceId, enabled); return { content: [{ type: 'text', text: `Device locate mode ${enabled ? 'enabled' : 'disabled'}. ${JSON.stringify(result, null, 2)}` }] }; }
- src/tools/devices.js:67-71 (schema)Zod input schema for the locate_device tool defining required hostId, deviceId, and optional enabled parameters.schema: z.object({ hostId: z.string().describe('The host ID'), deviceId: z.string().describe('The device ID'), enabled: z.boolean().optional().default(true).describe('Enable or disable locator mode') }),
- src/tools/devices.js:65-81 (registration)The complete registration of the locate_device tool within the deviceTools object, including description, schema, and handler.locate_device: { description: 'Flash the LEDs on a device to help physically locate it', schema: z.object({ hostId: z.string().describe('The host ID'), deviceId: z.string().describe('The device ID'), enabled: z.boolean().optional().default(true).describe('Enable or disable locator mode') }), handler: async ({ hostId, deviceId, enabled }) => { const result = await unifi.locateDevice(hostId, deviceId, enabled); return { content: [{ type: 'text', text: `Device locate mode ${enabled ? 'enabled' : 'disabled'}. ${JSON.stringify(result, null, 2)}` }] }; } },
- src/unifi-client.js:177-182 (helper)Helper function that performs the actual API call to the UniFi Cloud API to toggle device locator mode (LED flashing). Called by the tool handler.export async function locateDevice(hostId, deviceId, enabled = true) { const response = await cloudApi.post(`/v1/hosts/${hostId}/devices/${deviceId}/locate`, { enabled }); return response.data; }