Skip to main content
Glama
alxspiker

Windows Command Line MCP Server

get_service_info

Retrieve Windows service information, including detailed status for specific services or query all services, to monitor and manage system processes.

Instructions

Retrieve information about Windows services. Can query all services or get detailed status of a specific service.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionNoAction to performquery
serviceNameNoService name to get info about (optional)

Implementation Reference

  • The handler function for the 'get_service_info' tool. It checks if the platform is Windows, constructs a PowerShell command based on the 'action' ('query' or 'status') and optional 'serviceName', executes it using executeCommand, and returns the stdout or an error.
    async ({ action, serviceName }) => {
      if (!isWindows) {
        return {
          content: [
            {
              type: "text",
              text: "The service info tool is only available on Windows. Current platform: " + platform(),
            },
          ],
        };
      }
      
      try {
        let cmd = "powershell.exe -Command \"";
        
        if (action === "query") {
          if (serviceName) {
            cmd += "Get-Service -Name '" + serviceName + "' | Format-List Name, DisplayName, Status, StartType, Description";
          } else {
            cmd += "Get-Service | Select-Object Name, DisplayName, Status, StartType | Format-Table -AutoSize | Out-String";
          }
        } else if (action === "status" && serviceName) {
          cmd += "Get-Service -Name '" + serviceName + "' | Format-List *; " +
                "Get-CimInstance -ClassName Win32_Service -Filter \"Name='" + serviceName + "'\" | Format-List *";
        } else {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: "For 'status' action, serviceName parameter is required",
              },
            ],
          };
        }
        
        cmd += "\"";
        
        const stdout = executeCommand(cmd);
        
        return {
          content: [
            {
              type: "text",
              text: stdout.toString(),
            },
          ],
        };
      } catch (error) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error retrieving service info: ${error}`,
            },
          ],
        };
      }
    }
  • Input schema for the 'get_service_info' tool using Zod validation: 'action' enum (query/status, default query) and optional 'serviceName' string.
    {
      action: z.enum(["query", "status"]).default("query").describe("Action to perform"),
      serviceName: z.string().optional().describe("Service name to get info about (optional)"),
    },
  • index.ts:326-393 (registration)
    Registration of the 'get_service_info' tool on the MCP server, including name, description, input schema, and handler function.
    server.tool(
      "get_service_info",
      "Retrieve information about Windows services. Can query all services or get detailed status of a specific service.",
      {
        action: z.enum(["query", "status"]).default("query").describe("Action to perform"),
        serviceName: z.string().optional().describe("Service name to get info about (optional)"),
      },
      async ({ action, serviceName }) => {
        if (!isWindows) {
          return {
            content: [
              {
                type: "text",
                text: "The service info tool is only available on Windows. Current platform: " + platform(),
              },
            ],
          };
        }
        
        try {
          let cmd = "powershell.exe -Command \"";
          
          if (action === "query") {
            if (serviceName) {
              cmd += "Get-Service -Name '" + serviceName + "' | Format-List Name, DisplayName, Status, StartType, Description";
            } else {
              cmd += "Get-Service | Select-Object Name, DisplayName, Status, StartType | Format-Table -AutoSize | Out-String";
            }
          } else if (action === "status" && serviceName) {
            cmd += "Get-Service -Name '" + serviceName + "' | Format-List *; " +
                  "Get-CimInstance -ClassName Win32_Service -Filter \"Name='" + serviceName + "'\" | Format-List *";
          } else {
            return {
              isError: true,
              content: [
                {
                  type: "text",
                  text: "For 'status' action, serviceName parameter is required",
                },
              ],
            };
          }
          
          cmd += "\"";
          
          const stdout = executeCommand(cmd);
          
          return {
            content: [
              {
                type: "text",
                text: stdout.toString(),
              },
            ],
          };
        } catch (error) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Error retrieving service info: ${error}`,
              },
            ],
          };
        }
      }
    );
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. While it mentions the tool can 'retrieve information' and 'query all services or get detailed status,' it doesn't disclose important behavioral aspects like whether this requires administrative privileges, what format the information returns in, potential rate limits, or error conditions. The description provides basic functionality but lacks operational context.

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 perfectly concise with just two sentences that efficiently convey the tool's purpose and main functionality. Every word earns its place, and the information is front-loaded with the core purpose stated immediately. No wasted words or redundant information.

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

Completeness3/5

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

For a read-only information retrieval tool with 2 parameters and 100% schema coverage but no output schema, the description provides adequate basic context about what the tool does. However, it doesn't explain what information is returned, the format of the response, or how to interpret the results. Given the lack of output schema and no annotations, more detail about the return value would be helpful for completeness.

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?

The description adds some semantic context by explaining that the tool can 'query all services or get detailed status of a specific service,' which maps to the action parameter's enum values. However, with 100% schema description coverage where both parameters are well-documented in the schema, the description doesn't provide significant additional value beyond what's already in the structured schema. The baseline of 3 is appropriate when the schema does most of the parameter documentation work.

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 with specific verbs ('retrieve information', 'query', 'get detailed status') and identifies the resource ('Windows services'). It distinguishes between querying all services and getting status for a specific service, but doesn't explicitly differentiate from sibling tools like get_system_info or get_network_info that might also retrieve system information.

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

Usage Guidelines3/5

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

The description implies usage scenarios (query all services vs. get status for specific service) through the action parameter explanation, but doesn't provide explicit guidance on when to use this tool versus alternatives like get_system_info or get_scheduled_tasks. No when-not-to-use guidance or prerequisites are mentioned.

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/alxspiker/Windows-Command-Line-MCP-Server'

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