Skip to main content
Glama
gjenkins20

webmin-mcp-server

list_services

List all system services on a specified server to identify available services. Returns service names for further inspection of status or management.

Instructions

List all system services (systemd units or init scripts). Returns service names. Use get_service_status to check if a specific service is running.

Input Schema

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

Implementation Reference

  • The async function `list_services` that executes the tool logic. It calls `client.call('init', 'list_actions')` to fetch services, parses each action string to extract service names, and returns a ToolResult with a count and list of services.
    async def list_services(client: WebminClient) -> ToolResult:
        """List all system services.
    
        Args:
            client: Authenticated WebminClient instance.
    
        Returns:
            ToolResult with list of services.
        """
        try:
            actions = await client.call("init", "list_actions")
    
            services = []
            for action in actions:
                if isinstance(action, str):
                    # Format is "service_name timestamp"
                    parts = action.split()
                    name = parts[0] if parts else action
                    services.append({"name": name})
                else:
                    services.append(action)
    
            return ToolResult.ok({
                "count": len(services),
                "services": services,
            })
    
        except Exception as e:
            return ToolResult.fail(
                code="LIST_SERVICES_ERROR",
                message=f"Failed to list services: {e}",
            )
  • The tool registration/schema definition in the TOOLS list. Defines name 'list_services', its description, and inputSchema (accepts optional 'server' parameter).
    Tool(
        name="list_services",
        description=(
            "List all system services (systemd units or init scripts). "
            "Returns service names. Use get_service_status to check "
            "if a specific service is running."
        ),
        inputSchema={
            "type": "object",
            "properties": {**SERVER_PARAM},
            "required": [],
        },
    ),
  • The dispatch handler in `call_tool` / `dispatch_tool` that routes the 'list_services' tool name to the `system.list_services(client)` handler function.
    if name == "list_services":
        return await system.list_services(client)
  • The ToolResult model used by list_services to return success/failure responses with data or error details.
    class ToolResult(BaseModel):
        """Generic result wrapper for MCP tool responses."""
    
        success: bool = Field(
            description="Whether the operation succeeded",
        )
        data: dict[str, Any] | None = Field(
            default=None,
            description="Result data on success",
        )
        error: WebminError | None = Field(
            default=None,
            description="Error details on failure",
        )
    
        @classmethod
        def ok(cls, data: dict[str, Any]) -> "ToolResult":
            """Create a successful result."""
            return cls(success=True, data=data)
    
        @classmethod
        def fail(
            cls,
            code: str,
            message: str,
            details: dict[str, Any] | None = None,
        ) -> "ToolResult":
            """Create a failure result."""
            return cls(
                success=False,
                error=WebminError(code=code, message=message, details=details),
            )
Behavior4/5

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

With no annotations, the description must fully disclose behavior. It states it returns service names and lists all system services, implying a read-only operation. It could explicitly mention 'read-only' but the current text is sufficient for safe usage.

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?

Two sentences delivering full purpose and usage guidance with no redundancy. Front-loaded with the key action and result.

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

Completeness4/5

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

For a simple list tool with one parameter and no output schema, the description adequately covers what it does and returns. It references a sibling for further detail, making it complete for the given complexity.

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 only parameter 'server', and its description is already clear in the schema. The tool description does not add additional meaning beyond the schema, so baseline 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 clearly states the verb 'list' and the resource 'system services', specifying it returns service names. It distinguishes from sibling get_service_status by indicating it lists all services rather than checking a specific one.

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

Usage Guidelines5/5

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

Explicitly tells when to use get_service_status instead, providing clear guidance on using this tool for listing and the sibling for checking specific service status.

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