Skip to main content
Glama
MrGNSS

Desktop Commander MCP

kill_process

Terminate a running process by PID to stop unresponsive applications or manage system resources through the Desktop Commander MCP server.

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. Parses input arguments using KillProcessArgsSchema, kills the process using Node.js process.kill(), and returns a success message or throws an 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: an object with a required 'pid' number field.
    export const KillProcessArgsSchema = z.object({
      pid: z.number(),
    });
  • src/server.ts:96-101 (registration)
    Registers the 'kill_process' tool in the MCP server's tool list, providing name, description, and input schema derived from KillProcessArgsSchema.
      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)
    Switch case in the tool call handler that parses arguments and delegates execution to the killProcess handler function.
    case "kill_process": {
      const parsed = KillProcessArgsSchema.parse(args);
      return killProcess(parsed);
    }
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. It discloses that the action is 'forcefully terminate,' indicating destructive behavior, and warns of caution, which covers safety aspects. However, it lacks details on permissions needed, side effects (e.g., data loss), or error handling, leaving gaps for a mutation tool.

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

Conciseness5/5

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

The description is two sentences with zero waste: the first states the purpose, and the second provides crucial behavioral guidance. It is front-loaded with the core action and appropriately sized for a single-parameter tool.

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?

Given no annotations, no output schema, and low schema coverage, the description is moderately complete. It covers the destructive nature and caution needed but misses details like return values, error cases, or prerequisites. For a mutation tool with 1 parameter, it provides a baseline but lacks depth.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must compensate. It explains that 'pid' is used to 'terminate a running process by PID,' adding meaning beyond the schema's type definition. However, it does not specify PID format (e.g., integer), valid ranges, or how to obtain it, leaving some semantic gaps.

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 ('running process by PID'), distinguishing it from sibling tools like 'force_terminate' (which might be similar but has a different name) and 'list_processes' (which only reads). It provides a complete verb+resource+identifier combination.

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 includes explicit cautionary guidance ('Use with caution') and implies this is for forceful termination, but does not specify when to use alternatives like 'force_terminate' (a sibling tool) or other process management methods. It provides clear context about risk but lacks explicit alternatives.

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

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