Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

force_terminate

Terminate unresponsive terminal sessions by process ID to free system resources and regain control of the command line interface.

Instructions

Force terminate a running terminal session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYes

Implementation Reference

  • Main handler function for the 'force_terminate' tool. Parses input arguments using the schema, calls the terminal manager to terminate the process, and returns a formatted response.
    export async function forceTerminate(args: unknown) {
      const parsed = ForceTerminateArgsSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(`Invalid arguments for force_terminate: ${parsed.error}`);
      }
    
      const success = terminalManager.forceTerminate(parsed.data.pid);
      return {
        content: [{
          type: "text",
          text: success
            ? `Successfully initiated termination of session ${parsed.data.pid}`
            : `No active session found for PID ${parsed.data.pid}`
        }],
      };
    }
  • Zod schema defining the input arguments for the force_terminate tool: requires a numeric PID.
    export const ForceTerminateArgsSchema = z.object({
      pid: z.number(),
    });
  • src/server.ts:72-77 (registration)
    Registration of the 'force_terminate' tool in the server's listTools response, specifying name, description, and input schema.
    {
      name: "force_terminate",
      description:
        "Force terminate a running terminal session.",
      inputSchema: zodToJsonSchema(ForceTerminateArgsSchema),
    },
  • src/server.ts:224-227 (registration)
    Dispatch handler in the server's callTool request handler that parses arguments and delegates to the forceTerminate function.
    case "force_terminate": {
      const parsed = ForceTerminateArgsSchema.parse(args);
      return forceTerminate(parsed);
    }
  • Core implementation in TerminalManager that force terminates a process by PID using SIGINT followed by SIGKILL if necessary.
    forceTerminate(pid: number): boolean {
      const session = this.sessions.get(pid);
      if (!session) {
        return false;
      }
    
      try {
        session.process.kill('SIGINT');
        setTimeout(() => {
          if (this.sessions.has(pid)) {
            session.process.kill('SIGKILL');
          }
        }, 1000);
        return true;
      } catch (error) {
        console.error(`Failed to terminate process ${pid}:`, error);
        return false;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a 'force terminate' action which implies destructive behavior, but doesn't clarify permissions needed, side effects, or what happens to the terminal session. For a destructive tool with zero annotation coverage, this is insufficient.

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 a single, clear sentence with zero wasted words. It's appropriately sized for a simple tool and gets straight to the point without unnecessary elaboration.

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

Completeness2/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, no output schema, and 0% schema description coverage, the description is inadequate. It doesn't explain what 'force' means operationally, what permissions are required, what happens after termination, or how to identify the correct pid for a terminal session.

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

Parameters2/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 for the undocumented parameter. The description mentions terminating 'a running terminal session' but doesn't explain what 'pid' represents or how to obtain it. It adds minimal context beyond the schema's structural definition.

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

Purpose4/5

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

The description clearly states the action ('force terminate') and resource ('a running terminal session'), making the purpose immediately understandable. It doesn't distinguish from sibling tools like 'kill_process' which might serve a similar function, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'kill_process' or other process management tools. The description only states what it does, not when it's appropriate or what distinguishes it from siblings.

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/StrawHatAI/claude-dev-tools'

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