Skip to main content
Glama
yuki-yano

macOS Notify MCP

by yuki-yano

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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',
          },
        ],
      }
    }
  • 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: {},
            },
          },
        ],
      }
    })
  • 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 []
      }
    }

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/yuki-yano/macos-notify-mcp'

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