Skip to main content
Glama

kill_process

Forcefully terminate a running process by specifying its PID. Ideal for managing unresponsive or unwanted processes on your system through Desktop Commander MCP.

Instructions

Terminate a running process by PID. Use with caution as this will forcefully terminate the specified process.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYes

Implementation Reference

  • The main handler function for the kill_process tool. It parses the input arguments using KillProcessArgsSchema, kills the process using process.kill(pid), and returns a success message or throws an appropriate error.
    export async function killProcess(args: unknown) { const parsed = KillProcessArgsSchema.safeParse(args); if (!parsed.success) { throw new Error(`Invalid arguments for kill_process: ${parsed.error}`); } try { process.kill(parsed.data.pid); return { content: [{ type: "text", text: `Successfully terminated process ${parsed.data.pid}` }], }; } catch (error) { throw new Error(`Failed to kill process: ${error instanceof Error ? error.message : String(error)}`); } }
  • Zod schema defining the input for kill_process: requires a numeric 'pid'.
    export const KillProcessArgsSchema = z.object({ pid: z.number(), });
  • src/server.ts:96-101 (registration)
    Registers the kill_process tool in the MCP server's listTools response, providing name, description, and input schema.
    name: "kill_process", description: "Terminate a running process by PID. Use with caution as this will " + "forcefully terminate the specified process.", inputSchema: zodToJsonSchema(KillProcessArgsSchema), },
  • src/server.ts:232-235 (registration)
    In the CallToolRequest handler switch statement, dispatches kill_process calls to the killProcess function after parsing args.
    case "kill_process": { const parsed = KillProcessArgsSchema.parse(args); return killProcess(parsed); }

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/MrGNSS/ClaudeDesktopCommander'

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