get_running_services
Retrieve information about currently running services on Windows systems, with filtering options by service name and status for system monitoring and management.
Instructions
Get information about running services.
Args:
name: Filter services by name (supports wildcards)
status: Filter by status (Running, Stopped, etc.)
timeout: Command timeout in seconds (1-300, default 60)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| status | No | ||
| timeout | No |
Input Schema (JSON Schema)
{
"properties": {
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Status"
},
"timeout": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": 60,
"title": "Timeout"
}
},
"type": "object"
}
Implementation Reference
- src/server.py:92-110 (handler)The handler function for the 'get_running_services' tool. It constructs a PowerShell 'Get-Service' command with optional filters for service name and status, selects specific properties, formats the output as JSON, and executes it using the shared execute_powershell helper.@mcp.tool() async def get_running_services(name: Optional[str] = None, status: Optional[str] = None, timeout: Optional[int] = 60) -> str: """Get information about running services. Args: name: Filter services by name (supports wildcards) status: Filter by status (Running, Stopped, etc.) timeout: Command timeout in seconds (1-300, default 60) """ code = "Get-Service" filters = [] if name: filters.append(f"Name -like '{name}'") if status: filters.append(f"Status -eq '{status}'") if filters: code = f"{code} | Where-Object {{ {' -and '.join(filters)} }}" code = f"{code} | Select-Object Name, DisplayName, Status, StartType" return await execute_powershell(format_json_output(code), timeout)