playCompletionSound
Plays an audio notification when Cursor AI finishes generating code, providing immediate feedback for developers during programming tasks.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "playCompletionSound"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:18-33 (handler)The handler function for the 'playCompletionSound' tool. It plays a macOS system sound using the 'play-sound' library and returns a success or failure message in the MCP response format.
async () => { try { // Play macOS system sound audioPlayer.play(SYSTEM_SOUND, (err: Error | null) => { if (err) console.error('Error playing sound:', err); }); return { content: [{ type: 'text', text: 'Played completion sound' }] }; } catch (error) { console.error('Failed to play sound:', error); return { content: [{ type: 'text', text: 'Failed to play sound' }] }; } } - src/index.ts:15-34 (registration)Registers the 'playCompletionSound' tool with the MCP server, using an empty schema and the inline handler function.
server.tool( 'playCompletionSound', {}, async () => { try { // Play macOS system sound audioPlayer.play(SYSTEM_SOUND, (err: Error | null) => { if (err) console.error('Error playing sound:', err); }); return { content: [{ type: 'text', text: 'Played completion sound' }] }; } catch (error) { console.error('Failed to play sound:', error); return { content: [{ type: 'text', text: 'Failed to play sound' }] }; } } ); - src/index.ts:3-6 (helper)Helper code that imports the 'play-sound' module, initializes the audio player, and defines the path to the macOS Glass.aiff system sound used by the tool handler.
import player from 'play-sound'; const audioPlayer = player(); const SYSTEM_SOUND = '/System/Library/Sounds/Glass.aiff'; // macOS system sound