Skip to main content
Glama

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
NameRequiredDescriptionDefault
session_idYes

Implementation Reference

  • 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.",
            }
  • 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,
        },
    )

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/Hor1zonZzz/terminal-mcp'

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