Skip to main content
Glama

kill_port

Free a port held by a running process: preview exactly what would be stopped, then confirm to terminate it gracefully and verify the port is actually released.

Instructions

Free a port by stopping the process on it. TWO STEPS, never kills on the first call.

Step 1: call kill_port(port). Nothing is killed. You get a plan naming every process (and its child processes) that would be stopped, what each one is (dev server such as vite/next/uvicorn, docker-proxy, database...), and a single-use confirm_token valid for 60 seconds. Show the plan to the user. Step 2: after the user agrees, call kill_port(port, confirm_token=). Processes get a graceful terminate, then a force-kill after grace_seconds; the tool then verifies the port is actually free and reports anything that survived.

Always refused, even with force: PID 0, 1 and 4, this server, and its ancestors (your MCP client). Refused unless force=True on step 1: operating-system services (svchost, systemd, SYSTEM-account processes, ...). The token only works for the port it was issued for.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "port": "<port>"
    },
    "name": "kill_port"
  }
}

Input Schema

NameRequiredDescriptionDefault
portYes
forceNo
protocolNotcp
confirm_tokenNo
grace_secondsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

No annotations are supplied, so the description carries the full burden and does: it discloses the mandatory two-call confirmation flow, single-use token with a 60-second expiry, graceful-then-force escalation, post-kill verification of port state, and a hard refusal list of protected PIDs. These are exactly the safety-critical traits an agent cannot infer from structured fields.

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

Conciseness4/5

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

Front-loaded with the critical 'never kills on first call' constraint, then organized as labeled steps and a refusal paragraph, so scanning is easy. It is long, and a couple of clauses (e.g. examples of dev servers, the reminder to show the plan) are illustrative rather than load-bearing, but nothing is wasteful enough to impede use.

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

Completeness4/5

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

For a destructive, multi-step tool with no annotations, the description covers the flow, safety rails, escalation policy, and verification, and the output schema handles return-value explanation. Remaining gaps are minor but real: the protocol parameter is undefined and there is no statement about requiring elevated privileges or about token-expiry recovery.

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?

Schema description coverage is 0%, yet the description gives meaning to four of five parameters: port (scope of the token), confirm_token (single-use, port-bound, 60s), grace_seconds (graceful window before force-kill), and force (gate on OS-service kills in step 1). The 'protocol' parameter (default tcp) is never mentioned, leaving an ambiguity that matters for a destructive operation.

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?

States a specific verb and outcome ('Free a port by stopping the process on it') and immediately differentiates itself from inspection siblings via 'TWO STEPS, never kills on the first call.' An agent can tell this apart from whats_on_port or process_tree without opening the schema.

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

Usage Guidelines5/5

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

Gives an explicit ordered procedure (Step 1 dry-run, Step 2 with confirm_token after user agreement), plus explicit when-not conditions: PIDs 0/1/4, the server itself, its ancestors, and OS services absent force=True. The 60-second token validity and port-binding constraint tell the agent exactly how to retry correctly.

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