Skip to main content
Glama
pinkpixel-dev

Notifications MCP Server

play_notification

Play a notification sound to signal task completion, optionally displaying a message.

Instructions

Play a notification sound to indicate task completion

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageNoOptional message to display with notification

Implementation Reference

  • Handler for the play_notification tool. Checks the tool name, determines the sound file using getSoundFile(), plays it with platform-specific command (afplay on macOS, start on Windows), and returns success or error message.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      if (request.params.name !== "play_notification") {
        throw new Error("Unknown tool");
      }
    
      try {
        // Get the sound file to play (potentially random)
        const SOUND_FILE_TO_PLAY = getSoundFile();
        
        // Play sound using platform-specific command
        const command = process.platform === 'win32'
          ? `start "" "${SOUND_FILE_TO_PLAY}"`
          : `afplay "${SOUND_FILE_TO_PLAY}"`;
    
        await execAsync(command);
    
        return {
          content: [{
            type: "text",
            text: request.params.arguments?.message
              ? `Notification played: ${request.params.arguments.message}`
              : "Notification played successfully"
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `Failed to play notification: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    });
  • src/index.ts:73-91 (registration)
    Registers the play_notification tool by listing it in the ListToolsRequestSchema handler, including name, description, and input schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "play_notification",
            description: "Play a notification sound to indicate task completion",
            inputSchema: {
              type: "object",
              properties: {
                message: {
                  type: "string",
                  description: "Optional message to display with notification"
                }
              }
            }
          }
        ]
      };
    });
  • Input schema for the play_notification tool, defining an optional 'message' string property.
    inputSchema: {
      type: "object",
      properties: {
        message: {
          type: "string",
          description: "Optional message to display with notification"
        }
      }
    }
  • Helper function to determine the sound file path based on environment variables (MCP_NOTIFICATION_SOUND_PATH), default sound name (MCP_NOTIFICATION_SOUND or 'gentle'), or random selection.
    function getSoundFile(): string {
      if (USER_CONFIGURED_SOUND_PATH) {
        return USER_CONFIGURED_SOUND_PATH;
      }
      
      if (DEFAULT_SOUND_NAME === 'random') {
        return path.join(__dirname, '..', getRandomSound());
      }
      
      const DEFAULT_SOUND_FILE = SOUND_FILES[DEFAULT_SOUND_NAME as keyof typeof SOUND_FILES] || SOUND_FILES.gentle;
      return path.join(__dirname, '..', DEFAULT_SOUND_FILE);
    }
  • Helper function to select a random sound file name from the predefined SOUND_FILES.
    function getRandomSound(): string {
      const soundKeys = Object.keys(SOUND_FILES) as (keyof typeof SOUND_FILES)[];
      const randomKey = soundKeys[Math.floor(Math.random() * soundKeys.length)];
      return SOUND_FILES[randomKey];
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool plays a sound but doesn't describe what kind of sound, whether it's audible to all users, if it requires specific permissions, or any side effects. For a notification tool with zero annotation coverage, this is insufficient.

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, efficient sentence that communicates the core purpose without any wasted words. It's appropriately sized for a simple tool with one optional parameter.

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?

For a simple notification tool with one optional parameter and no output schema, the description covers the basic purpose adequately. However, without annotations or behavioral details, it leaves important questions unanswered about how the notification actually works in practice.

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 schema has 100% description coverage, so the parameter 'message' is already documented as 'Optional message to display with notification.' The description adds no additional parameter context beyond what's in the schema, meeting the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('Play') and resource ('notification sound') with a specific purpose ('to indicate task completion'). It's unambiguous about what the tool does, though it doesn't need to distinguish from siblings since none exist.

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 minimal guidance - it suggests using the tool 'to indicate task completion' but offers no explicit when-to-use rules, alternatives, or exclusions. No context about when this is appropriate versus other notification methods is given.

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/pinkpixel-dev/notification-mcp'

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