Skip to main content
Glama
wonderwhy-er

Claude Desktop Commander MCP

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({});
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: it lists active sessions, shows status details (PID, Blocked, Runtime), and provides debugging insights (e.g., blocked status indicates waiting for input, long runtime may indicate stuck processes). This adds valuable context beyond basic functionality, though it could mention potential limitations like rate limits or permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is structured with clear sections (purpose, status details, debugging tips, usage notes), but it includes some verbose or redundant elements, such as the debugging REPLs section repeating similar points and the final sentence about referencing commands, which may not be essential. It could be more streamlined while retaining key information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple list operation with 0 parameters, no annotations, no output schema), the description is mostly complete. It explains what the tool does, what information it provides, and how to use it for debugging. However, it lacks details on output format (e.g., structure of returned data) and any error conditions, which would enhance completeness for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter information is needed. The description appropriately focuses on output semantics and usage, adding value by explaining what the tool returns and how to interpret it, which compensates for the lack of an output schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('List all active terminal sessions') and resource ('terminal sessions'), distinguishing it from siblings like list_directory or list_processes. It provides concrete details about what information is shown (PID, Blocked status, Runtime), making the purpose unambiguous and specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes explicit usage guidance for debugging REPLs (e.g., 'Use this to verify sessions are running before sending input'), which helps clarify when to use this tool. However, it does not explicitly mention when NOT to use it or name specific alternatives among siblings, such as list_processes, which might be relevant for broader process monitoring.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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