os_notification
Send system-level notifications directly from the MCP Tools interface. Display custom messages and titles using native OS notification systems for real-time alerts and updates.
Instructions
Send OS notifications using native notification systems.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | The notification message to display | |
| title | No | Defaults to current project, generally omit |
Implementation Reference
- src/tools/osNotification.ts:16-22 (handler)Handler function that destructures args, selects notification strategy, executes the OS command, and returns a confirmation message.handler: (args) => { const { message, title = basename(util.CWD) } = args const strategy = getStrategy() const cmd = strategy.cmd(title, message) util.execSync(cmd, { stdio: 'ignore' }) return `Notification would have been sent via ${strategy.check} with title "${title}" and message "${message}"` },
- src/tools/osNotification.ts:9-12 (schema)Zod schema validating the input parameters: required 'message' string and optional 'title' string.schema: z.object({ message: z.string().min(1).describe('The notification message to display'), title: z.string().optional().describe('Defaults to current project, generally omit'), }),
- src/tools.ts:22-31 (registration)Central tools registry object where 'os_notification' is registered by assigning the imported tool, and exported as default.const tools = { read_symbol: readSymbol, import_symbol: importSymbol, search_replace: searchReplace, insert_text: insertText, os_notification: osNotification, utils_debug: utilsDebug, } as const satisfies Record<string, Tool<any>> export default tools
- src/tools/osNotification.ts:55-65 (helper)Memoized function to select the first available OS notification strategy by checking which command is available.const getStrategy = _.memoize((): NotificationStrategy => { for (const strategy of strategies) { try { util.execSync(`command -v ${strategy.check}`, { stdio: 'ignore' }) return strategy } catch { // Try next strategy } } throw new Error('No notification method available. Install notify-send, osascript, powershell, or wsl-notify-send') })
- src/tools/osNotification.ts:32-54 (helper)Array of platform-specific notification strategies, each with a check command and cmd generator for different OS notification methods.const strategies: NotificationStrategy[] = [ { check: 'notify-send', cmd: (title, message) => `notify-send "${title}" "${message}"`, }, { check: 'osascript', cmd: (title, message) => `osascript -e 'display notification "${message}" with title "${title}"'`, }, { check: 'powershell', cmd: (title, message) => `powershell -Command "Add-Type -AssemblyName System.Windows.Forms; \\$notify = New-Object System.Windows.Forms.NotifyIcon; \\$notify.Icon = [System.Drawing.SystemIcons]::Information; \\$notify.BalloonTipTitle = '${title}'; \\$notify.BalloonTipText = '${message}'; \\$notify.Visible = \\$true; \\$notify.ShowBalloonTip(5000); Start-Sleep -Seconds 2; \\$notify.Dispose()"`, }, { check: 'powershell.exe', cmd: (title, message) => `powershell.exe -Command "Add-Type -AssemblyName System.Windows.Forms; \\$notify = New-Object System.Windows.Forms.NotifyIcon; \\$notify.Icon = [System.Drawing.SystemIcons]::Information; \\$notify.BalloonTipTitle = '${title}'; \\$notify.BalloonTipText = '${message}'; \\$notify.Visible = \\$true; \\$notify.ShowBalloonTip(5000); Start-Sleep -Seconds 2; \\$notify.Dispose()"`, }, { check: 'wsl-notify-send.exe', cmd: (title, message) => `wsl-notify-send.exe --category "${title}" "${message}"`, }, ]