Skip to main content
Glama
nntkio

UniFi MCP Server

by nntkio

disconnect_client

Force disconnect a client from a UniFi network by MAC address to manage network access and resolve connectivity issues.

Instructions

Force disconnect a client from the network

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
macYesMAC address of the client to disconnect

Implementation Reference

  • MCP tool handler for disconnect_client: extracts MAC from arguments, calls UniFiClient.disconnect_client(mac), and returns success message.
    case "disconnect_client":
        mac = arguments.get("mac", "")
        await client.disconnect_client(mac)
        return [
            TextContent(
                type="text",
                text=f"Client {mac} has been disconnected.",
            )
        ]
  • Input schema definition for the disconnect_client tool, requiring a 'mac' string parameter.
    Tool(
        name="disconnect_client",
        description="Force disconnect a client from the network",
        inputSchema={
            "type": "object",
            "properties": {
                "mac": {
                    "type": "string",
                    "description": "MAC address of the client to disconnect",
                }
            },
            "required": ["mac"],
        },
    ),
  • Registers the disconnect_client tool via @server.list_tools() decorator by including it in the returned list of available tools.
    @server.list_tools()
    async def list_tools() -> list[Tool]:
        """List all available UniFi MCP tools."""
        return [
            # Device tools
            Tool(
                name="get_devices",
                description="Get all UniFi network devices (access points, switches, gateways)",
                inputSchema={
                    "type": "object",
                    "properties": {},
                    "required": [],
                },
            ),
            Tool(
                name="restart_device",
                description="Restart a UniFi network device by its MAC address",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "mac": {
                            "type": "string",
                            "description": "MAC address of the device to restart (e.g., '00:11:22:33:44:55')",
                        }
                    },
                    "required": ["mac"],
                },
            ),
            # Client tools
            Tool(
                name="get_clients",
                description="Get all currently connected clients on the UniFi network",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "include_offline": {
                            "type": "boolean",
                            "description": "Include offline/historical clients",
                            "default": False,
                        }
                    },
                    "required": [],
                },
            ),
            Tool(
                name="block_client",
                description="Block a client from accessing the network",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "mac": {
                            "type": "string",
                            "description": "MAC address of the client to block",
                        }
                    },
                    "required": ["mac"],
                },
            ),
            Tool(
                name="unblock_client",
                description="Unblock a previously blocked client",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "mac": {
                            "type": "string",
                            "description": "MAC address of the client to unblock",
                        }
                    },
                    "required": ["mac"],
                },
            ),
            Tool(
                name="disconnect_client",
                description="Force disconnect a client from the network",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "mac": {
                            "type": "string",
                            "description": "MAC address of the client to disconnect",
                        }
                    },
                    "required": ["mac"],
                },
            ),
            # Site tools
            Tool(
                name="get_sites",
                description="Get all UniFi sites configured on the controller",
                inputSchema={
                    "type": "object",
                    "properties": {},
                    "required": [],
                },
            ),
            Tool(
                name="get_site_health",
                description="Get health status for the current site",
                inputSchema={
                    "type": "object",
                    "properties": {},
                    "required": [],
                },
            ),
            Tool(
                name="get_networks",
                description="Get all network configurations for the current site",
                inputSchema={
                    "type": "object",
                    "properties": {},
                    "required": [],
                },
            ),
            # Activity tools
            Tool(
                name="get_device_activity",
                description="Get activity for a specific device including connected clients and their traffic",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "mac": {
                            "type": "string",
                            "description": "MAC address of the device (AP or switch)",
                        }
                    },
                    "required": ["mac"],
                },
            ),
        ]
  • Low-level implementation that sends UniFi API request to kick (disconnect) the client by MAC address.
    async def disconnect_client(self, mac: str) -> bool:
        """Force disconnect a client.
    
        Args:
            mac: Client MAC address.
    
        Returns:
            True if disconnect command was sent successfully.
        """
        await self._request(
            "POST",
            "/api/s/{site}/cmd/stamgr",
            json={"cmd": "kick-sta", "mac": mac.lower()},
        )
        return True
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Force disconnect', implying a destructive action, but doesn't clarify permanence (temporary vs. permanent), permissions required, side effects (e.g., if the client can reconnect automatically), or error handling. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—'Force disconnect a client from the network'—front-loading the core action and target. It's appropriately sized for a simple tool with one parameter.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a destructive action with no output schema and no annotations), the description is incomplete. It doesn't address behavioral aspects like what 'Force' entails, potential impacts, or response format, leaving the agent with insufficient context to use it safely and effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the 'mac' parameter fully documented in the schema as 'MAC address of the client to disconnect'. The description adds no additional parameter semantics beyond what the schema provides, so the baseline score of 3 is appropriate given the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Force disconnect') and target ('a client from the network'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'block_client' or 'unblock_client', which likely have related but distinct functions in client management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'block_client' or 'unblock_client'. It lacks context about prerequisites (e.g., needing client connectivity status), exclusions, or typical scenarios for force disconnection versus other actions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/nntkio/unifiMCP'

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