Skip to main content
Glama
taskhub-sh

Terminal Control MCP

by taskhub-sh

terminal_capture

Capture terminal screen output as PNG images to document or analyze command results and application states.

Instructions

Capture terminal screen as PNG screenshot

Args: session_id: ID of the terminal session

Returns: Dictionary with base64-encoded PNG image and metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function decorated with @mcp.tool(), implementing the terminal_capture tool. It retrieves the XTermSession for the given session_id, calls capture_screenshot() on it, and returns the base64 image data and metadata.
    @mcp.tool()
    async def terminal_capture(session_id: str) -> Dict[str, Any]:
        """Capture terminal screen as PNG screenshot
    
        Args:
            session_id: ID of the terminal session
    
        Returns:
            Dictionary with base64-encoded PNG image and metadata
        """
        if session_id not in sessions:
            return {"status": "error", "error": f"Session {session_id} not found"}
    
        session = sessions[session_id]
    
        try:
            screenshot_data = await session.capture_screenshot()
    
            logger.info(f"Captured screenshot for session {session_id}")
            return {
                "session_id": session_id,
                "status": "captured",
                "image_data": screenshot_data["image_data"],
                "metadata": screenshot_data["metadata"],
            }
    
        except Exception as e:
            logger.error(
                f"Failed to capture screenshot for session {session_id}: {e}"
            )
            return {"status": "error", "error": str(e)}
  • The @mcp.tool() decorator registers the terminal_capture function as an MCP tool.
    @mcp.tool()
  • Docstring defining the input schema (session_id: str) and output schema (dict with session_id, status, image_data, metadata).
    """Capture terminal screen as PNG screenshot
    
    Args:
        session_id: ID of the terminal session
    
    Returns:
        Dictionary with base64-encoded PNG image and metadata
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the tool captures a screenshot and returns a dictionary with base64-encoded PNG and metadata, but it does not cover critical aspects like required permissions, rate limits, error handling, or whether the capture is instantaneous or delayed. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core action and following with structured sections for Args and Returns. Every sentence earns its place by conveying key information without redundancy, though the formatting could be slightly more polished for optimal clarity.

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

Completeness3/5

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

Given the tool's moderate complexity (single parameter, no annotations, but with an output schema), the description is partially complete. It covers the basic purpose, parameter semantics, and return structure, but lacks usage guidelines and behavioral details. The presence of an output schema reduces the need to explain return values, but overall, it falls short of being fully comprehensive for effective agent use.

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?

The description adds meaningful context for the single parameter 'session_id' by specifying it as 'ID of the terminal session,' which clarifies its purpose beyond the schema's minimal title 'Session Id.' With 0% schema description coverage and only one parameter, the description effectively compensates by providing essential semantic information, though it could elaborate on format or constraints.

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 ('Capture terminal screen as PNG screenshot') and resource ('terminal session'), distinguishing it from sibling tools like terminal_close, terminal_input, and terminal_launch. It precisely communicates what the tool does without being vague or tautological.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. While it implies usage for capturing screenshots of terminal sessions, it does not mention prerequisites, exclusions, or specific scenarios where this tool is preferred over others. No explicit when/when-not or alternative tool references are included.

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