list_sessions
View all active terminal sessions managed by Desktop Commander MCP to monitor and manage running processes on your computer.
Instructions
List all active terminal sessions.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_sessions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/execute.ts:64-76 (handler)The main handler function for the list_sessions tool. It retrieves active terminal sessions from terminalManager and formats a response listing their PID, blocked status, and runtime.
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 defining the input arguments for list_sessions, which requires no parameters.
export const ListSessionsArgsSchema = z.object({}); - src/server.ts:78-83 (registration)Tool registration in the MCP server's listTools response, defining the name, description, and input schema for list_sessions.
{ name: "list_sessions", description: "List all active terminal sessions.", inputSchema: zodToJsonSchema(ListSessionsArgsSchema), }, - src/server.ts:228-229 (registration)Dispatch logic in the CallToolRequest handler that routes list_sessions calls to the listSessions function.
case "list_sessions": return listSessions();