get_processes
Retrieve details about active processes on a system, with options to filter by name, sort by resource usage, and limit results for monitoring and troubleshooting.
Instructions
Get information about running processes.
Args:
name: Filter processes by name (supports wildcards)
top: Limit to top N processes
sort_by: Property to sort by (e.g., CPU, WorkingSet)
timeout: Command timeout in seconds (1-300, default 60)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| top | No | ||
| sort_by | No | ||
| timeout | No |
Implementation Reference
- src/server.py:112-130 (handler)The @mcp.tool()-decorated handler function implementing the 'get_processes' tool. Constructs a filtered PowerShell 'Get-Process' command, formats output for JSON, and executes it securely.@mcp.tool() async def get_processes(name: Optional[str] = None, top: Optional[int] = None, sort_by: Optional[str] = None, timeout: Optional[int] = 60) -> str: """Get information about running processes. Args: name: Filter processes by name (supports wildcards) top: Limit to top N processes sort_by: Property to sort by (e.g., CPU, WorkingSet) timeout: Command timeout in seconds (1-300, default 60) """ code = "Get-Process" if name: code = f"{code} -Name '{name}'" if sort_by: code = f"{code} | Sort-Object -Property {sort_by} -Descending" if top: code = f"{code} | Select-Object -First {top}" code = f"{code} | Select-Object Name, Id, CPU, WorkingSet, StartTime" return await execute_powershell(format_json_output(code), timeout)