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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses key behavioral traits: it creates a new session, uses virtual X11 display, and returns session_id and status. However, it doesn't mention important aspects like whether sessions persist, authentication requirements, resource limits, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Perfectly structured with a clear purpose statement followed by organized sections for Args and Returns. Every sentence earns its place, with no redundant information. The description is appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (returns dictionary with session_id and status), the description doesn't need to explain return values. It covers the core functionality well but could benefit from more behavioral context about session lifecycle, especially since no annotations are provided.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description must compensate. It provides meaningful context for all 3 parameters: command specifies what to run, width and height define terminal dimensions. The default values are clearly stated, though it doesn't explain parameter constraints or valid ranges.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Launch a new terminal session') and distinguishes it from siblings like terminal_capture, terminal_close, and terminal_input by specifying it creates a new session with virtual X11 display rather than interacting with existing sessions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool (to start a new terminal session), but doesn't explicitly state when not to use it or mention alternatives like using terminal_input for existing sessions. The sibling tool names provide implicit differentiation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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