Skip to main content
Glama

process_kill

Terminate a specific process by its PID using the kill-process-mcp server, enabling direct and efficient process management across Windows, macOS, and Linux systems.

Instructions

Kill the process identified by the given PID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ctxNo
pidYes

Implementation Reference

  • The handler function for the 'process_kill' tool. It uses psutil to kill the process with the given PID, includes safety checks (refuses to kill self), logging via ctx, and error handling for no such process or access denied.
    @mcp.tool() async def process_kill(pid: int, ctx: Context | None = None) -> str: """Kill the process identified by the given PID""" if ctx: await ctx.info(f"process_kill called pid={pid}") if pid == os.getpid(): return "Refusing to kill MCP server process" try: proc = psutil.Process(pid) proc.kill() proc.wait(timeout=5) return f"Process {pid} terminated" except (psutil.NoSuchProcess, psutil.AccessDenied) as err: return f"Failed to kill {pid}: {err}"

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/misiektoja/kill-process-mcp'

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