get_host
Retrieve host information from UniFi network infrastructure to manage devices, clients, and access controls through the UniFi Cloud API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/network.js:51-56 (handler)The handler function for the 'get_host' MCP tool. It takes hostId, calls the unifi.getHost helper, and returns a formatted text response with JSON data.handler: async ({ hostId }) => { const host = await unifi.getHost(hostId); return { content: [{ type: 'text', text: JSON.stringify(host, null, 2) }] }; }
- src/tools/network.js:48-50 (schema)Zod input schema for the 'get_host' tool, validating the required 'hostId' parameter.schema: z.object({ hostId: z.string().describe('The host ID') }),
- src/tools/network.js:46-57 (registration)Tool configuration object for 'get_host' exported as part of networkTools, which includes description, schema, and handler.get_host: { description: 'Get details of a specific UniFi OS host', schema: z.object({ hostId: z.string().describe('The host ID') }), handler: async ({ hostId }) => { const host = await unifi.getHost(hostId); return { content: [{ type: 'text', text: JSON.stringify(host, null, 2) }] }; } },
- src/server.js:27-32 (registration)Registration of all tool modules, including networkTools containing 'get_host', into the MCP server using registerToolsFromModule.// Register all tool modules registerToolsFromModule(networkTools); registerToolsFromModule(deviceTools); registerToolsFromModule(clientTools); registerToolsFromModule(protectTools); registerToolsFromModule(accessTools);
- src/unifi-client.js:57-60 (helper)Supporting helper function that performs the actual UniFi Cloud API GET request to retrieve host details by ID.export async function getHost(hostId) { const response = await cloudApi.get(`/v1/hosts/${hostId}`); return response.data; }