terminal_close
Close terminal sessions to free system resources and manage multiple terminal windows effectively. Specify the session ID to terminate the connection and clean up associated processes.
Instructions
Close a terminal session.
Closes the terminal window and cleans up associated resources.
Args:
session_id: The terminal session ID to close.
Returns:
dict: Contains success status and message.Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes |
Implementation Reference
- src/terminal_mcp/server.py:220-238 (handler)The 'terminal_close' function acts as the handler for the MCP tool, invoking the 'SessionManager' to close the terminal session and returning the result.
async def terminal_close(session_id: str) -> dict: """Close a terminal session. Closes the terminal window and cleans up associated resources. Args: session_id: The terminal session ID to close. Returns: dict: Contains success status and message. """ manager = SessionManager.get_instance() success = await manager.close_session(session_id) if success: return { "success": True, "message": f"Terminal session '{session_id}' has been closed.", } - src/terminal_mcp/server.py:210-219 (registration)The 'terminal_close' tool is registered using the '@mcp.tool' decorator with the name 'terminal_close' and relevant metadata annotations.
@mcp.tool( name="terminal_close", annotations={ "title": "Close Terminal", "readOnlyHint": False, "destructiveHint": True, "idempotentHint": True, "openWorldHint": False, }, )