Skip to main content
Glama
wonderwhy-er

Claude Desktop Commander MCP

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,
        };
      }
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly states the destructive nature ('forcefully terminate') and includes a caution warning, which are essential behavioral traits. However, it doesn't mention potential side effects, error conditions, permission requirements, or what happens if the PID doesn't exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The first two sentences are well-structured and front-loaded with essential information. However, the third sentence about command referencing adds unnecessary length without improving tool understanding, reducing overall conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with no annotations and no output schema, the description provides adequate basic information about purpose and caution. However, it lacks details about return values, error handling, system impacts, and doesn't fully compensate for the missing structured documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage for its single parameter (pid), but the description adds meaningful context by specifying that it terminates 'a running process by PID'. This clarifies what the pid parameter represents and how it's used, though it doesn't provide format details or validation rules.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('terminate') and target resource ('a running process by PID'), distinguishing it from sibling tools like 'interact_with_process' or 'start_process'. It uses precise technical language that leaves no ambiguity about what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context with 'Use with caution as this will forcefully terminate the specified process', which implicitly suggests when to use it (for forceful termination) and hints at alternatives (less forceful methods). However, it doesn't explicitly name alternative tools or specify exact scenarios when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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