list_processes
View running processes in WSL environments to monitor system activity and identify specific applications using optional name filtering.
Instructions
List running processes in WSL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Filter by name |
Implementation Reference
- src/index.ts:203-228 (handler)Handler function that constructs a 'ps aux' command optionally filtered by process name using grep, executes it via command_executor, formats the output, and returns it in MCP format or an error response.async ({ filter }) => { try { const cmd = filter ? `ps aux | grep -i "${filter}" | grep -v grep` : 'ps aux'; const result = await this.command_executor.execute_command(cmd); return { content: [ { type: 'text' as const, text: this.format_output(result), }, ], }; } catch (error) { return { content: [ { type: 'text' as const, text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } },
- src/index.ts:191-198 (schema)Valibot schema for input parameters: optional filter string to grep process names.schema: v.object({ filter: v.optional( v.pipe( v.string(), v.description('Filter by name'), ), ), }),
- src/index.ts:187-229 (registration)MCP server tool registration including name, description, read-only annotation, input schema, and inline handler reference.this.server.tool( { name: 'list_processes', description: 'List running processes in WSL', schema: v.object({ filter: v.optional( v.pipe( v.string(), v.description('Filter by name'), ), ), }), annotations: { readOnlyHint: true, }, }, async ({ filter }) => { try { const cmd = filter ? `ps aux | grep -i "${filter}" | grep -v grep` : 'ps aux'; const result = await this.command_executor.execute_command(cmd); return { content: [ { type: 'text' as const, text: this.format_output(result), }, ], }; } catch (error) { return { content: [ { type: 'text' as const, text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }, );