Skip to main content
Glama
LukeLamb

claude-sessions-mcp

list_sessions

Read-only

List all tmux sessions with window count, timestamps, and attached status; returns empty list if no server is running.

Instructions

List all tmux sessions on the current user's tmux server. Returns name, window count, created/activity timestamps (ISO 8601), and attached status. Returns an empty list when no tmux server is running.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • server.js:77-99 (handler)
    The main handler function for the list_sessions tool. Runs 'tmux list-sessions' with a custom format, parses the output (name, windows, created_at, last_activity_at, attached), and returns a list of sessions. Returns an empty list when no tmux server is running.
    async function listSessions() {
      const missing = requireTmux();
      if (missing) return errorResult(missing);
    
      const fmt = '#{session_name}|#{session_windows}|#{session_created}|#{session_attached}|#{session_activity}';
      const r = await run(BIN.tmux, ['list-sessions', '-F', fmt]);
      // "no server running" is the normal empty-state response, not an error.
      if (r.code !== 0) {
        if (/no server running/i.test(r.stderr)) return textResult({ sessions: [] });
        return errorResult(`tmux list-sessions failed: ${r.stderr || r.stdout}`);
      }
      const sessions = r.stdout.split('\n').filter(Boolean).map((line) => {
        const [name, windows, created, attached, activity] = line.split('|');
        return {
          name,
          windows: parseInt(windows, 10),
          created_at: Number(created) ? new Date(Number(created) * 1000).toISOString() : null,
          last_activity_at: Number(activity) ? new Date(Number(activity) * 1000).toISOString() : null,
          attached: attached === '1',
        };
      });
      return textResult({ count: sessions.length, sessions });
    }
  • The tool registration schema for list_sessions. Defines the tool name, description, annotations (read-only, non-destructive), and input schema (empty object, no parameters).
    {
      name: 'list_sessions',
      description: 'List all tmux sessions on the current user\'s tmux server. Returns name, window count, created/activity timestamps (ISO 8601), and attached status. Returns an empty list when no tmux server is running.',
      annotations: { title: 'List tmux sessions', readOnlyHint: true, destructiveHint: false, openWorldHint: false },
      inputSchema: { type: 'object', properties: {}, additionalProperties: false },
    },
  • server.js:327-327 (registration)
    The handler registration mapping, binding 'list_sessions' to the listSessions function.
    list_sessions: listSessions,
Behavior4/5

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

Annotations already provide readOnlyHint and destructiveHint. Description adds beyond that by detailing return fields (ISO 8601 timestamps, attached status) and the edge case of an empty list when no tmux server is running.

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

Conciseness5/5

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

Two sentences, front-loaded with the main action, and every word adds value. No fluff or redundancy.

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

Completeness5/5

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

Given no parameters, no output schema, and annotations, the description fully covers what the tool does, its return values, and a key edge case (no server running).

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?

No parameters exist, and schema coverage is 100% (trivially). Per guidelines for 0 parameters, baseline is 4. Description does not need to add parameter details.

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?

Description clearly states 'List all tmux sessions' with specific return fields (name, window count, timestamps, attached status). It distinguishes from sibling tools like kill_session and new_session by focusing on listing only.

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 implies usage for reading sessions, not modifying them. However, it does not explicitly state when not to use or mention alternatives. The context from sibling tools helps, but clarity could be improved.

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/LukeLamb/claude-sessions-mcp'

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