list_sessions
List all active interactive process sessions to manage long-running programs such as SSH sessions, REPLs, and installers.
Instructions
List all interactive process sessions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Primary MCP tool handler for list_sessions, registered via @mcp.tool() decorator. Calls SessionManager.list_all() and returns session summaries.
@mcp.tool() def list_sessions() -> dict: """List all interactive process sessions.""" return {"sessions": _mgr.list_all()} - The function signature defines the schema: no arguments required, returns a dict with a 'sessions' key.
def list_sessions() -> dict: """List all interactive process sessions.""" return {"sessions": _mgr.list_all()} - Alternative handler for list_sessions in the tools.create_tools() factory. Takes an args dict (ignored) and returns session list.
def list_sessions(args: dict) -> dict: return {"sessions": mgr.list_all()} - src/interactive_process_mcp/tools.py:97-97 (registration)Registration of list_sessions in the tools tuple list returned by create_tools(). Used by tests to look up the handler.
("list_sessions", list_sessions), - SessionManager.list_all() helper that returns a list of session info dicts, used by both handler implementations.
def list_all(self) -> list[dict]: with self._lock: return [s.info() for s in self._sessions.values()]