kill-session
Terminate a tmux session by its ID to free system resources and manage terminal sessions effectively.
Instructions
Kill a tmux session by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | ID of the tmux session to kill |
Implementation Reference
- src/index.ts:237-255 (handler)MCP tool handler function for "kill-session". Takes sessionId, calls tmux.killSession, returns success or error message.async ({ sessionId }) => { try { await tmux.killSession(sessionId); return { content: [{ type: "text", text: `Session ${sessionId} has been killed` }] }; } catch (error) { return { content: [{ type: "text", text: `Error killing session: ${error}` }], isError: true }; } }
- src/index.ts:234-236 (schema)Input schema for kill-session tool using Zod: requires sessionId as string.{ sessionId: z.string().describe("ID of the tmux session to kill") },
- src/index.ts:231-256 (registration)Registration of the "kill-session" tool on the MCP server with name, description, schema, and handler.server.tool( "kill-session", "Kill a tmux session by ID", { sessionId: z.string().describe("ID of the tmux session to kill") }, async ({ sessionId }) => { try { await tmux.killSession(sessionId); return { content: [{ type: "text", text: `Session ${sessionId} has been killed` }] }; } catch (error) { return { content: [{ type: "text", text: `Error killing session: ${error}` }], isError: true }; } } );
- src/tmux.ts:179-181 (helper)Helper function killSession that executes the tmux 'kill-session' command via executeTmux.export async function killSession(sessionId: string): Promise<void> { await executeTmux(`kill-session -t '${sessionId}'`); }