Skip to main content
Glama
gjenkins20

webmin-mcp-server

list_users

List all system users on a Webmin server, returning regular users (UID >= 1000) and system users separately with details like home directory and shell.

Instructions

List all system users. Returns both regular users (UID >= 1000) and system users separately, with details like home directory and shell.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverNoServer alias (e.g., 'pi1', 'web-server'). Uses default server if not specified.

Implementation Reference

  • The list_users handler function. Calls Webmin's 'useradmin' module 'list_users' API, parses user data (username, uid, gid, home, shell), separates system users (UID < 1000) from regular users, and returns counts.
    async def list_users(client: WebminClient) -> ToolResult:
        """List all system users.
    
        Args:
            client: Authenticated WebminClient instance.
    
        Returns:
            ToolResult with list of users.
        """
        try:
            users_raw = await client.call("useradmin", "list_users")
    
            users = []
            for user in users_raw:
                if isinstance(user, dict):
                    users.append({
                        "username": user.get("user"),
                        "uid": user.get("uid"),
                        "gid": user.get("gid"),
                        "name": user.get("real"),
                        "home": user.get("home"),
                        "shell": user.get("shell"),
                    })
    
            # Separate system and regular users
            system_users = [u for u in users if u.get("uid", 0) < 1000]
            regular_users = [u for u in users if u.get("uid", 0) >= 1000]
    
            return ToolResult.ok({
                "total_count": len(users),
                "regular_users": regular_users,
                "regular_count": len(regular_users),
                "system_users": system_users,
                "system_count": len(system_users),
            })
    
        except Exception as e:
            return ToolResult.fail(
                code="LIST_USERS_ERROR",
                message=f"Failed to list users: {e}",
            )
  • Tool definition/schema for 'list_users' - registered as an MCP Tool with inputSchema requiring no parameters (only optional server).
    Tool(
        name="list_users",
        description=(
            "List all system users. Returns both regular users (UID >= 1000) "
            "and system users separately, with details like home directory and shell."
        ),
        inputSchema={
            "type": "object",
            "properties": {**SERVER_PARAM},
            "required": [],
        },
    ),
  • Dispatch routing: when the tool name is 'list_users', it calls system.list_users(client) to execute the handler.
    if name == "list_users":
        return await system.list_users(client)
  • Imports used by list_users handler: ToolResult (response model) and WebminClient (API client).
    """System information and monitoring tools for Webmin MCP Server.
    
    Phase 1 read-only tools for system monitoring and information gathering.
    """
    
    from typing import Any
    
    from ..models import ToolResult
    from ..webmin_client import WebminClient
  • Unit tests for the list_users tool, verifying successful listing with mock data.
    class TestListUsers:
        """Tests for list_users tool."""
    
        async def test_list_users_success(self, mock_client: AsyncMock) -> None:
            """Test successful user listing."""
            mock_client.call.return_value = [
                {"user": "root", "uid": 0, "gid": 0, "real": "root", "home": "/root", "shell": "/bin/bash"},
                {"user": "testuser", "uid": 1000, "gid": 1000, "real": "Test User", "home": "/home/testuser", "shell": "/bin/bash"},
            ]
    
            result = await system.list_users(mock_client)
    
            assert result.success
            assert result.data["total_count"] == 2
            assert result.data["regular_count"] == 1
            assert result.data["system_count"] == 1
            assert result.data["regular_users"][0]["username"] == "testuser"
Behavior3/5

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

With no annotations, the description carries the full burden. It discloses that the tool lists users and returns details, but does not mention any behavioral traits like authentication requirements, rate limits, or that it is a read-only operation (though implied).

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 two sentences long, front-loaded with the purpose, and contains no extraneous information. Every sentence adds value.

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

Completeness5/5

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

For a simple listing tool with no output schema, the description adequately covers what the tool does and what it returns (regular/system users, home directory, shell). No further details are necessary for effective invocation.

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 coverage is 100% for the single parameter 'server', which already has a description. The description adds no further meaning beyond what the schema provides, so baseline score of 3 is appropriate.

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

Purpose5/5

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

The description states exactly what the tool does: list all system users. It distinguishes itself from sibling tools like list_groups or list_user_quotas by specifying that it returns both regular and system users with details like home directory and shell.

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

Usage Guidelines4/5

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

The description implicitly conveys usage through its clear purpose and context among siblings. However, it does not explicitly state when to use this tool versus alternatives (e.g., list_user_quotas) or provide any exclusions.

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/gjenkins20/webmin-mcp-server'

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