Skip to main content
Glama
UserB1ank

interactive-process-mcp

by UserB1ank

start_process

Start an interactive process session for AI agents, specifying command, arguments, I/O mode (PTY/pipe), environment, and timeout. Returns session info for managing long-running programs.

Instructions

Start an interactive process and return its session info.

Args: command: The command to execute. args: Command arguments. mode: I/O mode — "pty" (pseudo-terminal) or "pipe". Default "pty". name: Optional human-readable session name. cwd: Working directory for the process. env: Environment variables (dict of string key-value pairs). timeout: Process startup timeout in seconds. rows: PTY row count (pty mode only). cols: PTY column count (pty mode only).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
argsNo
modeNopty
nameNo
cwdNo
envNo
timeoutNo
rowsNo
colsNo

Implementation Reference

  • The primary MCP tool handler for 'start_process' using @mcp.tool() decorator. Accepts typed parameters (command, args, mode, name, cwd, env, timeout, rows, cols), creates a session via SessionManager.create(), waits briefly, reads initial output, and returns session_id, pid, and initial_output.
    @mcp.tool()
    def start_process(
        command: str,
        args: list[str] | None = None,
        mode: str = "pty",
        name: str | None = None,
        cwd: str | None = None,
        env: dict[str, str] | None = None,
        timeout: float = 10.0,
        rows: int = 24,
        cols: int = 80,
    ) -> dict:
        """Start an interactive process and return its session info.
    
        Args:
            command: The command to execute.
            args: Command arguments.
            mode: I/O mode — "pty" (pseudo-terminal) or "pipe". Default "pty".
            name: Optional human-readable session name.
            cwd: Working directory for the process.
            env: Environment variables (dict of string key-value pairs).
            timeout: Process startup timeout in seconds.
            rows: PTY row count (pty mode only).
            cols: PTY column count (pty mode only).
        """
        session_id = _mgr.create(
            command=command,
            args=args or [],
            mode=mode,
            name=name,
            cwd=cwd,
            env=env,
            timeout=timeout,
            rows=rows,
            cols=cols,
        )
        time.sleep(0.1)
        session = _mgr.get(session_id)
        initial = session.read_output(timeout=0.5, strip_ansi_flag=True)
        return {
            "session_id": session_id,
            "pid": session.pid,
            "initial_output": initial,
        }
  • An alternative handler for 'start_process' defined inside create_tools() as a closure. Accepts a raw args dict, delegates to SessionManager.create(), and returns session_id, pid, and initial_output. This is used by the test suite.
    def start_process(args: dict) -> dict:
        session_id = mgr.create(
            command=args["command"],
            args=args.get("args", []),
            mode=args.get("mode", "pty"),
            name=args.get("name"),
            cwd=args.get("cwd"),
            env=args.get("env"),
            timeout=args.get("timeout", 10),
            rows=args.get("rows", 24),
            cols=args.get("cols", 80),
        )
        session = mgr.get(session_id)
        time.sleep(0.1)
        initial = session.read_output(timeout=0.5, strip_ansi_flag=True)
        return {
            "session_id": session_id,
            "pid": session.pid,
            "initial_output": initial,
        }
  • Registration of 'start_process' (and other tools) as a tuple list returned by create_tools(). The string 'start_process' maps to the start_process closure defined at line 16.
    return [
        ("start_process", start_process),
        ("send_input", send_input),
        ("read_output", read_output),
        ("send_and_read", send_and_read),
        ("list_sessions", list_sessions),
        ("terminate_process", terminate_process),
        ("resize_pty", resize_pty),
        ("get_session_info", get_session_info),
    ]
  • Registration via the @mcp.tool() decorator on the start_process function in server.py, which registers it with the FastMCP framework.
    @mcp.tool()
  • SessionManager.create() is the helper method called by both handlers to create and start a new Session, storing it in a thread-safe dict and returning the session ID.
    class SessionManager:
        def __init__(self):
            self._sessions: dict[str, Session] = {}
            self._lock = threading.Lock()
    
        def create(self, command: str, **kwargs) -> str:
            session = Session(command=command, **kwargs)
            session.start()
            with self._lock:
                self._sessions[session.id] = session
            return session.id
Behavior3/5

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

With no annotations, the description bears the full burden. It explains parameters like mode (pty/pipe) but does not disclose side effects (e.g., resource consumption, cleanup) or authorization needs. Moderate transparency.

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 well-structured as a docstring with bullet points for each parameter, and the first line clearly states the purpose. It is moderately sized with no redundant sentences, though minor trimming is possible.

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

Completeness2/5

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

Despite covering all parameters, the description lacks detail on the return value ('session info' is vague) and does not explain how to subsequently interact with the process using sibling tools. Given absent output schema and no annotations, this is insufficient.

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

Parameters5/5

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

All 9 parameters are explicitly described in the description, adding meaning beyond the schema's type and default values. For example, mode explains 'I/O mode — 'pty' (pseudo-terminal) or 'pipe'.' and timeout is 'Process startup timeout in seconds.'

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 'Start an interactive process and return its session info,' which is a specific action on a distinct resource. This distinguishes it from sibling tools that query sessions, read output, or send input.

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

Usage Guidelines3/5

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

The description implies usage for starting a process but does not explicitly state when to use it versus alternatives like get_session_info or send_input. No guidance on prerequisites or when not to use it.

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/UserB1ank/interactive-process-mcp'

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