kill_process
Terminate running processes by PID to manage system resources and stop unresponsive applications. Use this tool to forcefully end specific processes when needed.
Instructions
Terminate a running process by PID.
Use with caution as this will forcefully terminate the specified process.
This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pid | Yes |
Implementation Reference
- src/handlers/process-handlers.ts:19-25 (handler)Handler function for the 'kill_process' tool command. Parses arguments using the schema and delegates to the core killProcess function./** * Handle kill_process command */ export async function handleKillProcess(args: unknown): Promise<ServerResult> { const parsed = KillProcessArgsSchema.parse(args); return killProcess(parsed); }
- src/tools/process.ts:42-62 (handler)Core implementation of process killing. Validates arguments, calls Node.js process.kill(pid), and returns success/error ServerResult.export async function killProcess(args: unknown): Promise<ServerResult> { const parsed = KillProcessArgsSchema.safeParse(args); if (!parsed.success) { return { content: [{ type: "text", text: `Error: Invalid arguments for kill_process: ${parsed.error}` }], isError: true, }; } try { process.kill(parsed.data.pid); return { content: [{ type: "text", text: `Successfully terminated process ${parsed.data.pid}` }], }; } catch (error) { return { content: [{ type: "text", text: `Error: Failed to kill process: ${error instanceof Error ? error.message : String(error)}` }], isError: true, }; } }
- src/tools/schemas.ts:40-42 (schema)Zod schema for validating input arguments to kill_process tool, requiring a numeric PID.export const KillProcessArgsSchema = z.object({ pid: z.number(), });