Skip to main content
Glama
vandreus

UniFi MCP Server

by vandreus

get_offline_devices

Retrieve a list of offline devices from your UniFi network to identify connectivity issues and monitor network health.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the get_offline_devices tool logic: retrieves all devices, filters for offline status, and returns formatted JSON response.
    handler: async () => {
      const allDevices = await unifi.listAllDevices();
      const devices = allDevices.data || [];
    
      const offline = devices.filter(d => {
        const state = d.state;
        return state === 'OFFLINE' || state === 0 || state === 'DISCONNECTED';
      });
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({
            offlineCount: offline.length,
            totalDevices: devices.length,
            offlineDevices: offline
          }, null, 2)
        }]
      };
    }
  • Zod input schema for get_offline_devices tool (no parameters required).
    schema: z.object({}),
  • src/server.js:29-29 (registration)
    Registers the deviceTools object containing get_offline_devices into the MCP server via registerToolsFromModule.
    registerToolsFromModule(deviceTools);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vandreus/Unifi-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server