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}`, }, ], }; } } );

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