Skip to main content
Glama

list_processes

View all running processes on your system with detailed information including PID, command name, CPU usage, and memory usage for system monitoring and management.

Instructions

List all running processes. Returns process information including PID, command name, CPU usage, and memory usage. This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function registered for the 'list_processes' MCP tool. Delegates execution to the listProcesses utility function.
    /** * Handle list_processes command */ export async function handleListProcesses(): Promise<ServerResult> { return listProcesses(); }
  • Core utility function that executes the platform-specific process listing command ('ps aux' on Unix, 'tasklist' on Windows), parses the output, and formats it as a text response.
    export async function listProcesses(): Promise<ServerResult> { const command = os.platform() === 'win32' ? 'tasklist' : 'ps aux'; try { const { stdout } = await execAsync(command); const processes = stdout.split('\n') .slice(1) .filter(Boolean) .map(line => { const parts = line.split(/\s+/); return { pid: parseInt(parts[1]), command: parts[parts.length - 1], cpu: parts[2], memory: parts[3], } as ProcessInfo; }); return { content: [{ type: "text", text: processes.map(p => `PID: ${p.pid}, Command: ${p.command}, CPU: ${p.cpu}, Memory: ${p.memory}` ).join('\n') }], }; } catch (error) { return { content: [{ type: "text", text: `Error: Failed to list processes: ${error instanceof Error ? error.message : String(error)}` }], isError: true, }; } }
  • Zod schema defining the input arguments for the list_processes tool (no arguments required).
    export const ListProcessesArgsSchema = z.object({});
  • src/server.ts:903-916 (registration)
    Tool metadata registration in the ListToolsRequestHandler, defining name, description, input schema, and annotations for the MCP protocol.
    { name: "list_processes", description: ` List all running processes. Returns process information including PID, command name, CPU usage, and memory usage. ${CMD_PREFIX_DESCRIPTION}`, inputSchema: zodToJsonSchema(ListProcessesArgsSchema), annotations: { title: "List Running Processes", readOnlyHint: true, }, },
  • Dispatch logic in the CallToolRequestHandler that maps incoming 'list_processes' tool calls to the handleListProcesses handler.
    case "list_processes": result = await handlers.handleListProcesses(); break;

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/wonderwhy-er/ClaudeComputerCommander'

If you have feedback or need assistance with the MCP directory API, please join our Discord server