Skip to main content
Glama
nickgnd
by nickgnd

list-panes

List panes in a tmux window using the specified window ID, enabling users to manage and interact with terminal session layouts efficiently.

Instructions

List panes in a tmux window

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
windowIdYesID of the tmux window

Implementation Reference

  • src/index.ts:109-134 (registration)
    MCP server.tool registration for the 'list-panes' tool, including description, Zod input schema, and inline execution handler.
    server.tool( "list-panes", "List panes in a tmux window", { windowId: z.string().describe("ID of the tmux window") }, async ({ windowId }) => { try { const panes = await tmux.listPanes(windowId); return { content: [{ type: "text", text: JSON.stringify(panes, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing panes: ${error}` }], isError: true }; } } );
  • Zod input schema defining the required 'windowId' parameter for the tool.
    { windowId: z.string().describe("ID of the tmux window") },
  • Inline handler function that calls tmux.listPanes, serializes result to JSON text response, or returns error.
    async ({ windowId }) => { try { const panes = await tmux.listPanes(windowId); return { content: [{ type: "text", text: JSON.stringify(panes, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing panes: ${error}` }], isError: true }; } }
  • Helper function implementing the core logic: runs 'tmux list-panes', parses formatted output into array of TmuxPane objects.
    export async function listPanes(windowId: string): Promise<TmuxPane[]> { const format = "#{pane_id}:#{pane_title}:#{?pane_active,1,0}"; const output = await executeTmux(`list-panes -t '${windowId}' -F '${format}'`); if (!output) return []; return output.split('\n').map(line => { const [id, title, active] = line.split(':'); return { id, windowId, title: title, active: active === '1' }; }); }
  • TypeScript interface defining the structure of each pane object returned by listPanes.
    export interface TmuxPane { id: string; windowId: string; active: boolean; title: string; }

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