list_windows
Retrieve details of all windows in a tmux session, including index, name, active status, and pane count.
Instructions
List windows within a named session (index, name, active flag, pane count).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Session name. |
Implementation Reference
- server.js:112-131 (handler)The listWindows function that executes the 'list_windows' tool logic. It calls tmux list-windows with a format string and parses the output into structured window data (index, name, active, panes).
// ─── Tool: list_windows ─────────────────────────────────────────────────── async function listWindows(args) { const missing = requireTmux(); if (missing) return errorResult(missing); const bad = validSessionName(args.name); if (bad) return errorResult(bad); const fmt = '#{window_index}|#{window_name}|#{window_active}|#{window_panes}'; const r = await run(BIN.tmux, ['list-windows', '-t', `=${args.name}`, '-F', fmt]); if (r.code !== 0) return errorResult(`tmux list-windows failed: ${r.stderr || r.stdout}`); const windows = r.stdout.split('\n').filter(Boolean).map((line) => { const [index, name, active, panes] = line.split('|'); return { index: parseInt(index, 10), name, active: active === '1', panes: parseInt(panes, 10), }; }); return textResult({ session: args.name, count: windows.length, windows }); } - server.js:254-266 (schema)The tool registration definition for 'list_windows', including its description, annotations, and inputSchema (requires 'name' string).
{ name: 'list_windows', description: 'List windows within a named session (index, name, active flag, pane count).', annotations: { title: 'List session windows', readOnlyHint: true, destructiveHint: false, openWorldHint: false }, inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Session name.' }, }, required: ['name'], additionalProperties: false, }, }, - server.js:329-329 (registration)Mapping of 'list_windows' tool name to the listWindows handler function in the HANDLERS dispatch table.
list_windows: listWindows,