Skip to main content
Glama

list_sessions

Read-only

View active terminal sessions to monitor process status, identify blocked REPLs, and verify session activity before sending commands.

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 all active terminal sessions (real and virtual Node.js sessions) using terminalManager and formats the output.
    export async function listSessions(): Promise<ServerResult> {
      const sessions = terminalManager.listActiveSessions();
    
      // Include virtual Node.js sessions
      const virtualSessions = Array.from(virtualNodeSessions.entries()).map(([pid, session]) => ({
        pid,
        type: 'node:local',
        timeout_ms: session.timeout_ms
      }));
    
      const realSessionsText = sessions.map(s =>
        `PID: ${s.pid}, Blocked: ${s.isBlocked}, Runtime: ${Math.round(s.runtime / 1000)}s`
      );
    
      const virtualSessionsText = virtualSessions.map(s =>
        `PID: ${s.pid} (node:local), Timeout: ${s.timeout_ms}ms`
      );
    
      const allSessions = [...realSessionsText, ...virtualSessionsText];
    
      return {
        content: [{
          type: "text",
          text: allSessions.length === 0
            ? 'No active sessions'
            : allSessions.join('\n')
        }],
      };
    }
  • MCP wrapper handler for 'list_sessions' tool that delegates to the core listSessions implementation.
    export async function handleListSessions(): Promise<ServerResult> {
        return listSessions();
    }
  • Zod input schema for list_sessions tool (no arguments required).
    export const ListSessionsArgsSchema = z.object({});
  • src/server.ts:923-943 (registration)
    Tool registration in ListTools handler: defines name, description, inputSchema for 'list_sessions'.
        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,
        },
    },
  • Dispatch in CallTool handler: routes 'list_sessions' calls to handlers.handleListSessions().
    case "list_sessions":
        result = await handlers.handleListSessions();
        break;
Behavior4/5

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

Annotations provide readOnlyHint=true, which the description doesn't contradict. The description adds valuable behavioral context beyond annotations: it explains what status information is shown (PID, Blocked, Runtime), provides debugging guidance for interpreting 'Blocked: true', and mentions potential stuck process scenarios. This goes beyond the basic read-only annotation.

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 appropriately sized but has some structural issues. The first section clearly states the purpose, but the 'DEBUGGING REPLs' section could be more integrated. The final sentence about command referencing feels somewhat disconnected from the core functionality description.

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 this is a read-only tool with no parameters and no output schema, the description provides good context about what information is returned and how to interpret it. It covers the tool's purpose, usage scenarios, and output interpretation adequately for its complexity level.

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?

With 0 parameters and 100% schema description coverage, the baseline would be 4. The description appropriately doesn't discuss parameters since none exist, and instead focuses on what the tool returns and how to interpret the output.

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 sibling tools like list_processes or list_directory. The title annotation 'List Terminal Sessions' reinforces this, but the description provides the full verb+resource combination.

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 provides clear context for when to use this tool ('to verify sessions are running before sending input' and debugging REPLs), but doesn't explicitly state when NOT to use it or name specific alternatives. It distinguishes from siblings by focusing on terminal sessions rather than processes or directories.

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

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/ClaudeComputerCommander'

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