Skip to main content
Glama
vandreus

UniFi MCP Server

by vandreus

find_door_by_name

Locate and retrieve specific access door details within UniFi network infrastructure by using its name, enabling targeted management and control.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function implements the core logic: fetches all doors via unifi.listDoors, filters by name containing the query (case-insensitive), and returns JSON with matches.
    handler: async ({ hostId, query }) => {
      const queryLower = query.toLowerCase();
      const doorsResponse = await unifi.listDoors(hostId);
      const doors = doorsResponse.data || [];
    
      const matches = doors.filter(d => {
        const name = (d.name || '').toLowerCase();
        return name.includes(queryLower);
      });
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({
            searchQuery: query,
            matchCount: matches.length,
            matches
          }, null, 2)
        }]
      };
    }
  • Zod schema defining input parameters: hostId (string) and query (string).
    schema: z.object({
      hostId: z.string().describe('The host ID'),
      query: z.string().describe('The search query for door name')
    }),
  • src/server.js:32-32 (registration)
    Registers all tools from the accessTools module (including find_door_by_name) with the MCP server using registerToolsFromModule.
    registerToolsFromModule(accessTools);
  • src/server.js:6-6 (registration)
    Import of the accessTools module containing the find_door_by_name tool definition.
    import { accessTools } from './tools/access.js';

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