Skip to main content
Glama

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
NameRequiredDescriptionDefault
messageYesThe notification message to display
titleNoDefaults to current project, generally omit

Implementation Reference

  • 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}"`
    },
  • 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
  • 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')
    })
  • 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}"`,
      },
    ]
Install Server

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/flesler/mcp-tools'

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