Skip to main content
Glama

process_manager

Manage Windows processes by listing, monitoring, killing, and analyzing resource usage to optimize system performance and troubleshoot issues.

Instructions

Comprehensive process management including listing processes, getting process details, killing processes, and monitoring resource usage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe process management action to perform
process_idNoProcess ID for specific process operations
process_nameNoProcess name for searching or filtering
sort_byNoSort processes by specified criteria (default: cpu)cpu
limitNoLimit number of results (default: 20)
include_systemNoInclude system processes (default: true)

Implementation Reference

  • The main handler function for the process_manager tool. It takes input arguments, switches on the 'action' parameter, and delegates to specific helper methods for process listing, details, killing, etc. Handles errors by returning an error response.
    async run(args: { action: string; process_id?: number; process_name?: string; sort_by?: string; limit?: number; include_system?: boolean; }) { try { switch (args.action) { case "list_processes": return await this.listProcesses(args.sort_by, args.limit, args.include_system); case "get_process_details": return await this.getProcessDetails(args.process_id, args.process_name); case "kill_process": return await this.killProcess(args.process_id, args.process_name); case "find_process": return await this.findProcess(args.process_name!); case "get_top_processes": return await this.getTopProcesses(args.sort_by, args.limit); case "get_process_tree": return await this.getProcessTree(); default: throw new Error(`Unknown action: ${args.action}`); } } catch (error: any) { return { content: [{ type: "text", text: `❌ Process management operation failed: ${error.message}` }], isError: true }; } },
  • Input schema defining the parameters for the process_manager tool, including required 'action' and optional fields like process_id, sort_by, etc.
    parameters: { type: "object", properties: { action: { type: "string", enum: ["list_processes", "get_process_details", "kill_process", "find_process", "get_top_processes", "get_process_tree"], description: "The process management action to perform" }, process_id: { type: "number", description: "Process ID for specific process operations" }, process_name: { type: "string", description: "Process name for searching or filtering" }, sort_by: { type: "string", enum: ["cpu", "memory", "name", "pid"], description: "Sort processes by specified criteria (default: cpu)", default: "cpu" }, limit: { type: "number", description: "Limit number of results (default: 20)", default: 20 }, include_system: { type: "boolean", description: "Include system processes (default: true)", default: true } }, required: ["action"] },
  • src/index.ts:32-36 (registration)
    Registration of the process_manager tool in the ListToolsRequestSchema handler, providing name, description, and inputSchema.
    { name: processManagerTool.name, description: processManagerTool.description, inputSchema: processManagerTool.parameters },
  • src/index.ts:73-74 (registration)
    Tool call dispatching in the CallToolRequestSchema handler: switches on tool name and calls processManagerTool.run().
    case "process_manager": return await processManagerTool.run(args as any);
  • Helper method to list processes, sorted by criteria, with limits and system process filtering, using PowerShell commands.
    async listProcesses(sortBy = "cpu", limit = 20, includeSystem = true) { try { const sortProperty = this.getSortProperty(sortBy); const systemFilter = includeSystem ? "" : "| Where-Object {$_.SessionId -ne 0}"; const command = `Get-Process ${systemFilter} | Sort-Object ${sortProperty} -Descending | Select-Object -First ${limit} Name, Id, CPU, WorkingSet, VirtualMemorySize, SessionId, StartTime | Format-Table -AutoSize`; const { stdout } = await execAsync(`powershell -Command "${command}"`); return { content: [{ type: "text", text: `# Process List\n\nSorted by: ${sortBy}\nLimit: ${limit}\nInclude System: ${includeSystem}\n\n\`\`\`\n${stdout}\n\`\`\`` }] }; } catch (error: any) { throw new Error(`Failed to list processes: ${error.message}`); }

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