Skip to main content
Glama
alxspiker

Windows Command Line MCP Server

get_scheduled_tasks

Retrieve information about scheduled tasks on Windows systems. Query all tasks or get detailed status of specific tasks to monitor and manage automated system operations.

Instructions

Retrieve information about scheduled tasks on the system. Can query all tasks or get detailed status of a specific task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionNoAction to performquery
taskNameNoName of the specific task (optional)

Implementation Reference

  • The asynchronous handler function that executes the get_scheduled_tasks tool logic. It checks if the platform is Windows, constructs a PowerShell command based on the 'action' (query or status) and optional 'taskName', executes it using executeCommand, and returns the output or error.
    async ({ action, taskName }) => {
      if (!isWindows) {
        return {
          content: [
            {
              type: "text",
              text: "The scheduled tasks tool is only available on Windows. Current platform: " + platform(),
            },
          ],
        };
      }
      
      try {
        let cmd = "powershell.exe -Command \"";
        
        if (action === "query") {
          if (taskName) {
            cmd += "Get-ScheduledTask -TaskName '" + taskName + "' | Format-List TaskName, State, Description, Author, LastRunTime, NextRunTime, LastTaskResult";
          } else {
            cmd += "Get-ScheduledTask | Select-Object TaskName, State, Description | Format-Table -AutoSize | Out-String";
          }
        } else if (action === "status" && taskName) {
          cmd += "Get-ScheduledTask -TaskName '" + taskName + "' | Format-List *; " +
                "Get-ScheduledTaskInfo -TaskName '" + taskName + "' | Format-List *";
        } else {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: "For 'status' action, taskName 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 scheduled tasks: ${error}`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for the get_scheduled_tasks tool: 'action' (enum: query or status, defaults to query) and optional 'taskName' (string).
    {
      action: z.enum(["query", "status"]).default("query").describe("Action to perform"),
      taskName: z.string().optional().describe("Name of the specific task (optional)"),
    },
  • index.ts:256-323 (registration)
    The server.tool call that registers the get_scheduled_tasks tool, providing the name, description, input schema, and handler function.
    server.tool(
      "get_scheduled_tasks",
      "Retrieve information about scheduled tasks on the system. Can query all tasks or get detailed status of a specific task.",
      {
        action: z.enum(["query", "status"]).default("query").describe("Action to perform"),
        taskName: z.string().optional().describe("Name of the specific task (optional)"),
      },
      async ({ action, taskName }) => {
        if (!isWindows) {
          return {
            content: [
              {
                type: "text",
                text: "The scheduled tasks tool is only available on Windows. Current platform: " + platform(),
              },
            ],
          };
        }
        
        try {
          let cmd = "powershell.exe -Command \"";
          
          if (action === "query") {
            if (taskName) {
              cmd += "Get-ScheduledTask -TaskName '" + taskName + "' | Format-List TaskName, State, Description, Author, LastRunTime, NextRunTime, LastTaskResult";
            } else {
              cmd += "Get-ScheduledTask | Select-Object TaskName, State, Description | Format-Table -AutoSize | Out-String";
            }
          } else if (action === "status" && taskName) {
            cmd += "Get-ScheduledTask -TaskName '" + taskName + "' | Format-List *; " +
                  "Get-ScheduledTaskInfo -TaskName '" + taskName + "' | Format-List *";
          } else {
            return {
              isError: true,
              content: [
                {
                  type: "text",
                  text: "For 'status' action, taskName 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 scheduled tasks: ${error}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions retrieving information, which implies a read-only operation, but doesn't disclose behavioral traits such as permissions required, potential rate limits, whether it returns real-time or cached data, or error conditions. For a system tool with zero annotation coverage, this is a significant gap in transparency.

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, front-loaded with the core purpose and followed by key usage details. Every word earns its place without redundancy, making it highly efficient and easy to parse.

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?

Given no annotations and no output schema, the description is minimally adequate for a read-only tool with well-documented parameters. It covers the basic purpose and parameter implications but lacks details on return values, error handling, or system-specific constraints. For a tool interacting with system tasks, more context would be beneficial.

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 clear descriptions for both parameters (e.g., 'Action to perform' for 'action' and 'Name of the specific task' for 'taskName'). The description adds some value by explaining that 'query' retrieves all tasks and 'status' gets detailed info for a specific task, but this mostly reiterates what the enum and schema imply. Baseline 3 is appropriate since the schema does 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 verb ('Retrieve information') and resource ('scheduled tasks on the system'), making the purpose unambiguous. It distinguishes between querying all tasks and getting detailed status of a specific task, which is helpful. However, it doesn't explicitly differentiate from sibling tools like 'get_service_info' or 'list_running_processes' that also retrieve system information, preventing a perfect score.

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 guidelines by mentioning 'all tasks' vs. 'specific task', which correlates with the 'action' parameter. However, it lacks explicit guidance on when to use this tool versus alternatives like 'get_service_info' for services or 'list_running_processes' for processes. No exclusions or prerequisites are stated, leaving some ambiguity.

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