Skip to main content
Glama

tmux_list_sessions

View active tmux sessions with details like name, windows, creation time, and attachment status to manage terminal workflows.

Instructions

List all active tmux sessions with their details (name, windows, created time, attached status).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Executes the tmux list-sessions command using execAsync, parses the output into structured session data (name, windows, created time, attached status), and returns it as JSON text content.
    async listSessions() { try { const { stdout } = await execAsync( "tmux list-sessions -F '#{session_name}|#{session_windows}|#{session_created}|#{session_attached}' 2>/dev/null || echo ''" ); if (!stdout.trim()) { return { content: [ { type: "text", text: "No active tmux sessions", }, ], }; } const sessions = stdout .trim() .split("\n") .map((line) => { const [name, windows, created, attached] = line.split("|"); const createdDate = new Date(parseInt(created) * 1000); return { name, windows: parseInt(windows), created: createdDate.toISOString(), attached: attached === "1", }; }); return { content: [ { type: "text", text: JSON.stringify(sessions, null, 2), }, ], }; } catch (error) { throw new Error(`Failed to list sessions: ${error.message}`); } }
  • Defines the tool name, description, and empty input schema for tmux_list_sessions in the list of tools.
    { name: "tmux_list_sessions", description: "List all active tmux sessions with their details (name, windows, created time, attached status).", inputSchema: { type: "object", properties: {}, }, },
  • src/index.js:193-194 (registration)
    Registers the handler dispatch for tmux_list_sessions in the CallToolRequest switch statement.
    case "tmux_list_sessions": return await this.listSessions();

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/MediocreTriumph/tmux-mcp'

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