Skip to main content
Glama
zhiyingzzhou

AI Notify MCP

by zhiyingzzhou

show_completion_notification

Display system notifications when AI finishes generating responses in MCP-compatible code editors, supporting macOS, Windows, and Linux with customizable titles, messages, and sound options.

Instructions

Show a system notification when AI completes a response

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNoNotification titleAI Assistant
messageNoNotification message已完成回答
soundNoPlay notification sound

Implementation Reference

  • The handler function for the 'show_completion_notification' tool. It extracts title, message, and sound from arguments, formats the title with project name, sends the notification using notificationService, and returns a success message.
    case 'show_completion_notification': {
      const title = (args?.title as string) || 'AI Assistant';
      const message = (args?.message as string) || '已完成回答';
      const sound = (args?.sound as boolean) ?? true;
    
      await notificationService.notify({
        title: formatNotificationTitle(title, projectName),
        message,
        sound,
        icon: iconPath,
      });
    
      return {
        content: [
          {
            type: 'text',
            text: `✅ 系统通知已发送: "${message}"`,
          },
        ],
      };
    }
  • Input schema for the 'show_completion_notification' tool defining properties for title, message, and sound with descriptions and defaults.
    inputSchema: {
      type: 'object',
      properties: {
        title: {
          type: 'string',
          description: 'Notification title',
          default: 'AI Assistant',
        },
        message: {
          type: 'string',
          description: 'Notification message',
          default: '已完成回答',
        },
        sound: {
          type: 'boolean',
          description: 'Play notification sound',
          default: true,
        },
      },
    },
  • src/index.ts:140-163 (registration)
    Registration of the 'show_completion_notification' tool in the listTools response, including name, description, and input schema.
    {
      name: 'show_completion_notification',
      description: 'Show a system notification when AI completes a response',
      inputSchema: {
        type: 'object',
        properties: {
          title: {
            type: 'string',
            description: 'Notification title',
            default: 'AI Assistant',
          },
          message: {
            type: 'string',
            description: 'Notification message',
            default: '已完成回答',
          },
          sound: {
            type: 'boolean',
            description: 'Play notification sound',
            default: true,
          },
        },
      },
    },
  • Helper function createNotificationService that creates a cross-platform notification service using node-notifier, handling different OS-specific options and fallbacks.
    const createNotificationService = (): NotificationService => {
      // 创建 notifier 实例
      const notifier = new NodeNotifier.NotificationCenter();
    
      return {
        notify: (options: NotificationOptions): Promise<void> => {
          return new Promise((resolve, reject) => {
            try {
              const platform = os.platform();
              const iconPath = getNotificationIcon();
    
              const finalOptions: NotificationOptions = {
                ...options,
                wait: false,
                timeout: 5,
              };
    
              // 根据平台配置声音和图标
              if (options.sound) {
                if (platform === 'darwin') {
                  finalOptions.sound = 'Ping';
                  // 在 macOS 上使用 contentImage 显示图标
                  finalOptions.contentImage = iconPath;
                } else if (platform === 'win32') {
                  finalOptions.sound = true;
                  finalOptions.icon = iconPath;
                } else if (platform === 'linux') {
                  finalOptions.urgency = 'normal';
                  finalOptions.icon = iconPath;
                }
              }
    
              // 调用通知
              notifier.notify(finalOptions, (error: Error | null) => {
                if (error) {
                  console.error('通知发送失败:', error);
                  // 尝试使用备用方案
                  try {
                    console.log(`[${options.title}] ${options.message}`);
                    resolve();
                  } catch (fallbackErr) {
                    reject(fallbackErr);
                  }
                } else {
                  resolve();
                }
              });
            } catch (err) {
              console.error('通知服务错误:', err);
              reject(err);
            }
          });
        },
      };
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the action ('Show a system notification') but lacks details on platform-specific behavior, error handling, user permissions required, or whether it's synchronous/asynchronous. For a tool with no annotations, this leaves significant gaps in understanding its operational traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the core functionality without unnecessary words. It is front-loaded with the main action and condition, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (3 parameters, no output schema, no annotations), the description is minimally adequate but incomplete. It covers the basic purpose but lacks usage guidelines, behavioral details, and output information, which are needed for a tool that interacts with system notifications. The schema compensates for parameter semantics, but overall completeness is limited.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, documenting all three parameters (title, message, sound) with defaults. The description does not add any meaning beyond the schema, such as explaining parameter interactions or usage examples. With high schema coverage, the baseline score of 3 is appropriate as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Show') and resource ('a system notification'), and it specifies the trigger condition ('when AI completes a response'). This distinguishes it from the sibling tool 'auto_notify_completion', which might imply automation rather than manual invocation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the sibling 'auto_notify_completion', nor does it mention any prerequisites, exclusions, or alternative scenarios. It merely states what the tool does without contextual usage advice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/zhiyingzzhou/ai-notify-mcp'

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