playCompletionSound
Play a sound effect when Cursor AI finishes code generation to provide immediate audio feedback, enhancing interactivity during coding.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:18-33 (handler)Handler function for the 'playCompletionSound' tool that plays a macOS system completion sound using the 'play-sound' library and returns a textual response indicating success or failure.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, providing an empty input 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)Imports the 'play-sound' module, initializes the audio player instance, and defines the path to the macOS system sound file used by the handler.import player from 'play-sound'; const audioPlayer = player(); const SYSTEM_SOUND = '/System/Library/Sounds/Glass.aiff'; // macOS system sound