list_sessions
View all active terminal sessions with status details including PID, blocked status, and runtime duration to monitor processes and debug REPL sessions.
Instructions
List all active terminal sessions.
Shows session status including:
- PID: Process identifier
- Blocked: Whether session is waiting for input
- Runtime: How long the session has been running
DEBUGGING REPLs:
- "Blocked: true" often means REPL is waiting for input
- Use this to verify sessions are running before sending input
- Long runtime with blocked status may indicate stuck process
This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:881-902 (registration)Tool metadata registration in ListToolsRequestSchema handler, defining name, description, input schema, and annotations for 'list_sessions' tool.{ name: "list_sessions", description: ` List all active terminal sessions. Shows session status including: - PID: Process identifier - Blocked: Whether session is waiting for input - Runtime: How long the session has been running DEBUGGING REPLs: - "Blocked: true" often means REPL is waiting for input - Use this to verify sessions are running before sending input - Long runtime with blocked status may indicate stuck process ${CMD_PREFIX_DESCRIPTION}`, inputSchema: zodToJsonSchema(ListSessionsArgsSchema), annotations: { title: "List Terminal Sessions", readOnlyHint: true, }, },
- src/handlers/terminal-handlers.ts:50-55 (handler)Handler function registered with MCP server that delegates list_sessions tool execution to the core listSessions implementation./** * Handle list_sessions command */ export async function handleListSessions(): Promise<ServerResult> { return listSessions(); }
- Core implementation of list_sessions tool logic: retrieves active sessions from terminalManager and formats output showing PID, blocked status, and runtime./** * List active sessions */ export async function listSessions(): Promise<ServerResult> { const sessions = terminalManager.listActiveSessions(); return { content: [{ type: "text", text: sessions.length === 0 ? 'No active sessions' : sessions.map(s => `PID: ${s.pid}, Blocked: ${s.isBlocked}, Runtime: ${Math.round(s.runtime / 1000)}s` ).join('\n') }], }; }
- src/server.ts:1220-1222 (registration)Dispatch registration in CallToolRequestSchema handler: routes 'list_sessions' calls to handleListSessions.case "list_sessions": result = await handlers.handleListSessions(); break;
- src/tools/schemas.ts:38-38 (schema)Zod schema definition for list_sessions input arguments (empty object as no parameters required).export const ListSessionsArgsSchema = z.object({});