Skip to main content
Glama

list_sessions

View active terminal sessions, including PIDs, blocked status, and runtime, to debug REPLs, verify session activity, and identify stuck processes using Desktop Commander MCP.

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that lists active terminal sessions using terminalManager and formats the output as text.
    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') }], }; }
  • Thin wrapper handler for the MCP 'list_sessions' tool that delegates to the core listSessions() function.
    * Handle list_sessions command */ export async function handleListSessions(): Promise<ServerResult> { return listSessions(); }
  • Dispatch registration in CallToolRequest handler: calls handleListSessions() when 'list_sessions' tool is invoked.
    case "list_sessions": result = await handlers.handleListSessions(); break;
  • src/server.ts:881-902 (registration)
    Tool specification registration in ListToolsRequest handler, including name, description, and input schema.
    { 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, }, },
  • Zod schema for list_sessions tool input (empty args).
    export const ListSessionsArgsSchema = z.object({});

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/wonderwhy-er/DesktopCommanderMCP'

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