list_tmux_sessions
Retrieve available tmux sessions to enable targeted macOS notifications that focus specific sessions when clicked.
Instructions
List available tmux sessions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:176-189 (handler)The main tool handler for 'list_tmux_sessions' that invokes notifier.listSessions() and formats the result into a text response.case 'list_tmux_sessions': { const sessions = await notifier.listSessions() return { content: [ { type: 'text', text: sessions.length > 0 ? `Available tmux sessions:\n${sessions.map((s) => `- ${s}`).join('\n')}` : 'No tmux sessions found', }, ], } }
- src/index.ts:83-90 (schema)Schema definition for the 'list_tmux_sessions' tool, specifying name, description, and empty input schema (no parameters required).{ name: 'list_tmux_sessions', description: 'List available tmux sessions', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:42-101 (registration)Registration of the tool via the ListToolsRequest handler, which statically returns the list of available tools including 'list_tmux_sessions'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: 'send_notification', description: 'Send a macOS notification with optional tmux integration', inputSchema: { type: 'object', properties: { message: { type: 'string', description: 'The notification message', }, title: { type: 'string', description: 'The notification title (default: "Claude Code")', }, sound: { type: 'string', description: 'The notification sound (default: "Glass")', }, session: { type: 'string', description: 'tmux session name', }, window: { type: 'string', description: 'tmux window number', }, pane: { type: 'string', description: 'tmux pane number', }, useCurrent: { type: 'boolean', description: 'Use current tmux location', }, }, required: ['message'], }, }, { name: 'list_tmux_sessions', description: 'List available tmux sessions', inputSchema: { type: 'object', properties: {}, }, }, { name: 'get_current_tmux_info', description: 'Get current tmux session information', inputSchema: { type: 'object', properties: {}, }, }, ], } })
- src/notifier.ts:421-432 (helper)Core helper function that executes 'tmux list-sessions -F #{session_name}' to retrieve the list of tmux sessions.async listSessions(): Promise<string[]> { try { const output = await this.runCommand('tmux', [ 'list-sessions', '-F', '#{session_name}', ]) return output.trim().split('\n').filter(Boolean) } catch (_error) { return [] } }