Skip to main content
Glama

kill_process

Destructive

Terminate a running process by PID to manage system resources and resolve unresponsive applications. Use with caution as this forcefully ends the specified process.

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

  • Handler function that receives the tool call for kill_process, parses the arguments using the schema, and delegates to the killProcess helper function.
    /**
     * Handle kill_process command
     */
    export async function handleKillProcess(args: unknown): Promise<ServerResult> {
        const parsed = KillProcessArgsSchema.parse(args);
        return killProcess(parsed);
    }
  • Core implementation function that validates arguments (with safeParse fallback), calls Node.js process.kill(pid), and returns success or error response.
    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,
        };
      }
    }
  • Zod schema defining the input arguments for kill_process tool: requires a numeric PID.
    export const KillProcessArgsSchema = z.object({
      pid: z.number(),
    });
  • src/server.ts:958-973 (registration)
    MCP tool registration object defining the name 'kill_process', description, input schema reference, and annotations for the ListTools response.
    {
        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 case in the CallToolRequest handler switch statement that routes 'kill_process' calls to the handleKillProcess function.
    case "kill_process":
        result = await handlers.handleKillProcess(args);
        break;
Behavior4/5

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

The description adds valuable behavioral context beyond annotations by explicitly warning 'Use with caution as this will forcefully terminate the specified process.' While annotations already indicate destructiveHint=true, this description reinforces the irreversible nature of the action and provides practical caution that helps the agent understand the tool's impact better than annotations alone.

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 description is appropriately brief with three sentences, but the third sentence about referencing commands feels disconnected from the core functionality and doesn't add value for tool selection. The first two sentences are well-structured and front-loaded with the essential information, but the extraneous third sentence reduces overall efficiency.

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 output schema and minimal parameter documentation, the description provides adequate but incomplete context. It covers the core destructive behavior and basic usage, but lacks information about error conditions, permissions required, or what happens when termination fails. The annotations help but don't fully compensate for these gaps.

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?

With 0% schema description coverage, the description doesn't add any parameter-specific information beyond what's implied by context. It mentions 'by PID' which relates to the 'pid' parameter, but provides no details about PID format, valid ranges, or how to obtain PIDs. The schema must carry the full parameter documentation burden.

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 ('a running process by PID'), distinguishing it from sibling tools like 'interact_with_process' or 'list_processes'. 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 for when to use this tool ('Terminate a running process by PID') and includes a cautionary note about forceful termination. However, it doesn't explicitly mention when NOT to use it or name specific alternatives like 'force_terminate' (a sibling tool) or 'stop_search' for different termination scenarios.

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/wonderwhy-er/ClaudeComputerCommander'

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