Skip to main content
Glama
taskhub-sh

Terminal Control MCP

by taskhub-sh

terminal_launch

Launch a new terminal session with virtual X11 display to run commands and capture visual output for AI agents interacting with terminal applications.

Instructions

Launch a new terminal session with virtual X11 display

Args: command: Command to run in terminal (default: bash) width: Terminal width in characters (default: 80) height: Terminal height in characters (default: 24)

Returns: Dictionary with session_id and status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandNobash
widthNo
heightNo

Implementation Reference

  • The handler function for the 'terminal_launch' tool. It is registered via the @mcp.tool() decorator. Creates and starts a new XTermSession with the specified command, dimensions, stores it in the sessions dict, and returns session details or error.
    @mcp.tool() async def terminal_launch( command: str = "bash", width: int = 80, height: int = 24 ) -> Dict[str, Any]: """Launch a new terminal session with virtual X11 display Args: command: Command to run in terminal (default: bash) width: Terminal width in characters (default: 80) height: Terminal height in characters (default: 24) Returns: Dictionary with session_id and status """ try: session = XTermSession(command=command, width=width, height=height) await session.start() session_id = session.session_id sessions[session_id] = session logger.info( f"Launched terminal session {session_id} with command: {command}" ) return { "session_id": session_id, "status": "launched", "command": command, "width": width, "height": height, } except Exception as e: logger.error(f"Failed to launch terminal session: {e}") return {"status": "error", "error": str(e)}
  • The @mcp.tool() decorator registers the terminal_launch function as an MCP tool.
    @mcp.tool()
  • Type hints and docstring define the input schema (command, width, height) and output (dict with session_id, status).
    async def terminal_launch( command: str = "bash", width: int = 80, height: int = 24 ) -> Dict[str, Any]: """Launch a new terminal session with virtual X11 display Args: command: Command to run in terminal (default: bash) width: Terminal width in characters (default: 80) height: Terminal height in characters (default: 24) Returns: Dictionary with session_id and status

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/taskhub-sh/terminal-driver-mcp'

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