Skip to main content
Glama

service_manager

Manage Windows services by listing, starting, stopping, restarting, and monitoring service status to maintain system functionality.

Instructions

Windows service management including listing services, getting service details, starting/stopping services, and monitoring service status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe service management action to perform
service_nameNoService name for specific service operations
status_filterNoFilter services by status (default: all)all
startup_type_filterNoFilter services by startup type (default: all)all
search_termNoSearch term for finding services
limitNoLimit number of results (default: 50)

Implementation Reference

  • Main handler function for the service_manager tool. Dispatches to specific service management actions based on the 'action' parameter.
    async run(args: {
      action: string;
      service_name?: string;
      status_filter?: string;
      startup_type_filter?: string;
      search_term?: string;
      limit?: number;
    }) {
      try {
        switch (args.action) {
          case "list_services":
            return await this.listServices(args.status_filter, args.startup_type_filter, args.limit);
          case "get_service_details":
            return await this.getServiceDetails(args.service_name!);
          case "start_service":
            return await this.startService(args.service_name!);
          case "stop_service":
            return await this.stopService(args.service_name!);
          case "restart_service":
            return await this.restartService(args.service_name!);
          case "get_service_status":
            return await this.getServiceStatus(args.service_name!);
          case "find_service":
            return await this.findService(args.search_term!);
          case "get_running_services":
            return await this.getRunningServices(args.limit);
          case "get_startup_services":
            return await this.getStartupServices(args.limit);
          default:
            throw new Error(`Unknown action: ${args.action}`);
        }
      } catch (error: any) {
        return {
          content: [{
            type: "text",
            text: `❌ Service management operation failed: ${error.message}`
          }],
          isError: true
        };
      }
    },
  • Input schema definition for the service_manager tool, including parameters for various actions.
    name: "service_manager",
    description: "Windows service management including listing services, getting service details, starting/stopping services, and monitoring service status",
    parameters: {
      type: "object",
      properties: {
        action: {
          type: "string",
          enum: ["list_services", "get_service_details", "start_service", "stop_service", "restart_service", "get_service_status", "find_service", "get_running_services", "get_startup_services"],
          description: "The service management action to perform"
        },
        service_name: {
          type: "string",
          description: "Service name for specific service operations"
        },
        status_filter: {
          type: "string",
          enum: ["running", "stopped", "paused", "all"],
          description: "Filter services by status (default: all)",
          default: "all"
        },
        startup_type_filter: {
          type: "string",
          enum: ["automatic", "manual", "disabled", "all"],
          description: "Filter services by startup type (default: all)",
          default: "all"
        },
        search_term: {
          type: "string",
          description: "Search term for finding services"
        },
        limit: {
          type: "number",
          description: "Limit number of results (default: 50)",
          default: 50
        }
      },
      required: ["action"]
    },
  • src/index.ts:47-51 (registration)
    Registration of service_manager tool in the MCP server's list tools handler.
    {
      name: serviceManagerTool.name,
      description: serviceManagerTool.description,
      inputSchema: serviceManagerTool.parameters
    },
  • src/index.ts:79-80 (registration)
    Dispatcher registration for handling calls to the service_manager tool in the MCP server's call tool handler.
    case "service_manager":
      return await serviceManagerTool.run(args as any);
  • Helper method to list Windows services with optional status, startup type filters, and limit.
    async listServices(statusFilter = "all", startupTypeFilter = "all", limit = 50) {
      try {
        let whereClause = "";
        const conditions: string[] = [];
        
        if (statusFilter !== "all") {
          conditions.push(`$_.Status -eq '${this.mapStatusFilter(statusFilter)}'`);
        }
        
        if (startupTypeFilter !== "all") {
          conditions.push(`$_.StartType -eq '${this.mapStartupTypeFilter(startupTypeFilter)}'`);
        }
        
        if (conditions.length > 0) {
          whereClause = `| Where-Object {${conditions.join(' -and ')}}`;
        }
        
        const command = `Get-Service ${whereClause} | Select-Object -First ${limit} Name, DisplayName, Status, StartType | Sort-Object DisplayName | Format-Table -AutoSize`;
        
        const { stdout } = await execAsync(`powershell -Command "${command}"`);
        
        return {
          content: [{
            type: "text",
            text: `# Windows Services\n\nStatus Filter: ${statusFilter}\nStartup Type Filter: ${startupTypeFilter}\nLimit: ${limit}\n\n\`\`\`\n${stdout}\n\`\`\``
          }]
        };
      } catch (error: any) {
        throw new Error(`Failed to list services: ${error.message}`);
      }
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions actions like starting/stopping services but doesn't disclose critical traits: whether these operations require elevated privileges, potential system impacts, rate limits, error handling, or what 'monitoring service status' entails. For a tool with potentially destructive operations, this is a significant gap.

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

Conciseness4/5

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

The description is appropriately concise (one sentence) and front-loaded with the core purpose. It efficiently lists the main capabilities without unnecessary elaboration. However, it could be slightly more structured by grouping related operations (e.g., query vs. control operations).

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 (6 parameters, multiple action types including potentially destructive operations), no annotations, and no output schema, the description is incomplete. It doesn't address permission requirements, system impacts, return formats, or error conditions. For a service management tool with start/stop/restart capabilities, this leaves significant gaps for an AI agent.

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%, so the schema already documents all 6 parameters thoroughly with enums, defaults, and descriptions. The description adds no parameter-specific information beyond what's in the schema. According to guidelines, when schema coverage is high (>80%), the baseline is 3 even with no param info in description.

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 tool's purpose as 'Windows service management' with specific verbs (listing, getting, starting/stopping, monitoring) and resources (services). It distinguishes itself from siblings like process_manager or system_info by focusing specifically on Windows services. However, it doesn't explicitly differentiate from all siblings (e.g., network could also involve service monitoring).

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. It doesn't mention prerequisites (e.g., administrative privileges), when to choose service_manager over process_manager for similar operations, or any context about Windows-specific requirements. The agent must infer usage from the description alone.

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/guangxiangdebizi/windows-system-mcp'

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