Skip to main content
Glama

kill_process

Terminate a running process by its PID using the MCP server. Forcefully ends the specified process, enabling efficient process management on your computer.

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
NameRequiredDescriptionDefault
pidYes

Implementation Reference

  • MCP handler function for kill_process tool that parses arguments and delegates to core killProcess function
    /** * Handle kill_process command */ export async function handleKillProcess(args: unknown): Promise<ServerResult> { const parsed = KillProcessArgsSchema.parse(args); return killProcess(parsed); }
  • Zod schema definition for kill_process input arguments (pid: number)
    export const KillProcessArgsSchema = z.object({ pid: z.number(), });
  • src/server.ts:918-932 (registration)
    Tool registration in list_tools handler: defines name, description, input schema reference
    name: "kill_process", description: ` Terminate a running process by PID. Use with caution as this will forcefully terminate the specified process. ${CMD_PREFIX_DESCRIPTION}`, inputSchema: zodToJsonSchema(KillProcessArgsSchema), annotations: { title: "Kill Process", readOnlyHint: false, destructiveHint: true, openWorldHint: false, }, },
  • Dispatch to handleKillProcess in call_tool request handler switch statement
    case "kill_process": result = await handlers.handleKillProcess(args); break;
  • Core implementation: parses args, calls Node.js process.kill(pid), handles errors and returns 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, }; } }

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/DesktopCommanderMCP'

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