Skip to main content
Glama

send_notification

Send macOS notifications with optional tmux integration, enabling targeted alerts for specific tmux sessions, windows, or panes when clicked.

Instructions

Send a macOS notification with optional tmux integration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesThe notification message
paneNotmux pane number
sessionNotmux session name
soundNoThe notification sound (default: "Glass")
titleNoThe notification title (default: "Claude Code")
useCurrentNoUse current tmux location
windowNotmux window number

Implementation Reference

  • MCP tool handler for 'send_notification': validates arguments, handles tmux current/useCurrent logic, validates session existence, calls notifier.sendNotification, and returns success/error content.
    case 'send_notification': { // Safely extract properties from args const notificationArgs = args as Record<string, unknown> // Validate message is provided if (!notificationArgs.message) { throw new Error('Message is required') } const options: NotificationOptions = { message: String(notificationArgs.message), title: notificationArgs.title ? String(notificationArgs.title) : undefined, sound: notificationArgs.sound ? String(notificationArgs.sound) : undefined, } if (notificationArgs.useCurrent) { const current = await notifier.getCurrentTmuxInfo() if (current) { options.session = current.session options.window = current.window options.pane = current.pane } } else { if (notificationArgs.session) options.session = String(notificationArgs.session) if (notificationArgs.window) options.window = String(notificationArgs.window) if (notificationArgs.pane) options.pane = String(notificationArgs.pane) } // Validate session if specified if (options.session) { const exists = await notifier.sessionExists(options.session) if (!exists) { const sessions = await notifier.listSessions() return { content: [ { type: 'text', text: `Error: Session '${options.session}' does not exist. Available sessions: ${sessions.join(', ')}`, }, ], } } } await notifier.sendNotification(options) return { content: [ { type: 'text', text: `Notification sent: "${options.message}"${options.session ? ` (tmux: ${options.session})` : ''}`, }, ], } }
  • src/index.ts:45-82 (registration)
    Registration of the 'send_notification' tool in the ListTools response, including name, description, and input schema.
    { 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'], }, },
  • Core implementation of sendNotification in TmuxNotifier: destructures options, detects terminal, builds open command arguments for MacOSNotifyMCP.app, and executes it.
    async sendNotification(options: NotificationOptions): Promise<void> { const { title = this.defaultTitle, message, sound = 'Glass', session, window, pane, } = options // Check if app path is valid if (!this.appPath) { throw new Error('MacOSNotifyMCP.app not found') } // Always detect terminal emulator to pass to notification app const terminal = await this.detectTerminalEmulator() // Use MacOSNotifyMCP.app for notifications const args = [ '-n', this.appPath, '--args', '-t', title, '-m', message, '--sound', sound, '--terminal', terminal, ] if (session) { args.push('-s', session) if (window !== undefined && window !== '') { args.push('-w', window) } if (pane !== undefined && pane !== '') { args.push('-p', pane) } } await this.runCommand('/usr/bin/open', args) } }
  • Type definition for NotificationOptions used by sendNotification.
    interface NotificationOptions { title?: string message: string sound?: string session?: string window?: string pane?: 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/yuki-yano/macos-notify-mcp'

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