list_sessions
View all active terminal sessions managed by Desktop Commander MCP to monitor and manage ongoing command executions and processes.
Instructions
List all active terminal sessions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/execute.ts:64-76 (handler)The main handler function that lists active terminal sessions using terminalManager.listActiveSessions() and formats the output.export async function listSessions() { 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/tools/schemas.ts:17-17 (schema)Zod schema for list_sessions input arguments (empty object as no arguments are required).export const ListSessionsArgsSchema = z.object({});
- src/server.ts:78-83 (registration)Registration of the list_sessions tool in the server's listTools response, including name, description, and input schema.{ name: "list_sessions", description: "List all active terminal sessions.", inputSchema: zodToJsonSchema(ListSessionsArgsSchema), },