list_processes
Lists running Windows processes to monitor system activity, identify resource usage, and manage applications. Use optional filters to find specific processes by name.
Instructions
列出正在运行的进程
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | 过滤进程名(可选) |
Implementation Reference
- src/tools/process.js:107-128 (handler)The handler function for list_processes tool. Executes 'tasklist' command to list processes, parses CSV output, applies optional filter, and returns the list with success status.async listProcesses(filter = '') { try { const { stdout } = await execAsync('tasklist /FO CSV /NH'); const lines = stdout.trim().split('\n'); const processes = lines.map(line => { const parts = line.split(',').map(p => p.replace(/"/g, '')); return { name: parts[0], pid: parts[1], memory: parts[4], }; }); const filtered = filter ? processes.filter(p => p.name.toLowerCase().includes(filter.toLowerCase())) : processes; return { success: true, processes: filtered, count: filtered.length }; } catch (error) { return { success: false, error: error.message }; } }
- src/tools/process.js:37-46 (schema)Schema definition for the list_processes tool, including name, description, and input schema allowing optional filter string.{ name: 'list_processes', description: '列出正在运行的进程', inputSchema: { type: 'object', properties: { filter: { type: 'string', description: '过滤进程名(可选)' }, }, }, },
- src/tools/process.js:72-73 (registration)Registration and dispatch logic in the executeTool method's switch statement, routing 'list_processes' calls to the listProcesses handler.case 'list_processes': return await this.listProcesses(args.filter);