Skip to main content
Glama
nickgnd
by nickgnd

list-windows

Retrieve and display all windows within a specified tmux session using the session ID. Ideal for managing and monitoring multiple terminal workflows within a session.

Instructions

List windows in a tmux session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the tmux session

Implementation Reference

  • MCP tool handler: fetches windows using tmux.listWindows(sessionId) and returns formatted text response or error
    async ({ sessionId }) => { try { const windows = await tmux.listWindows(sessionId); return { content: [{ type: "text", text: JSON.stringify(windows, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing windows: ${error}` }], isError: true }; } }
  • Zod input schema defining required 'sessionId' parameter
    { sessionId: z.string().describe("ID of the tmux session") },
  • src/index.ts:81-106 (registration)
    Registers the 'list-windows' MCP tool with description, schema, and handler function
    server.tool( "list-windows", "List windows in a tmux session", { sessionId: z.string().describe("ID of the tmux session") }, async ({ sessionId }) => { try { const windows = await tmux.listWindows(sessionId); return { content: [{ type: "text", text: JSON.stringify(windows, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing windows: ${error}` }], isError: true }; } } );
  • Core helper function that executes the tmux 'list-windows' command, parses the formatted output into TmuxWindow objects
    export async function listWindows(sessionId: string): Promise<TmuxWindow[]> { const format = "#{window_id}:#{window_name}:#{?window_active,1,0}"; const output = await executeTmux(`list-windows -t '${sessionId}' -F '${format}'`); if (!output) return []; return output.split('\n').map(line => { const [id, name, active] = line.split(':'); return { id, name, active: active === '1', sessionId }; }); }

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

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