Skip to main content
Glama

playCompletionSound

Plays a sound to provide audio feedback when Cursor AI completes code generation, enhancing interactivity during coding.

Instructions

Plays a completion sound when called

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler logic for the playCompletionSound tool. Plays the completion.mp3 sound file asynchronously using the play-sound library, with error handling and MCP response formatting.
    async () => { try { // Play custom sound using a Promise to handle the callback properly await new Promise<void>((resolve, reject) => { audioPlayer.play(COMPLETION_SOUND, (err: Error | null) => { if (err) { log(`Error playing sound: ${err.message}`); reject(err); } else { log('Played completion sound successfully'); resolve(); } }); }); // Return proper JSON response return { content: [{ type: 'text', text: 'Played completion sound' }] }; } catch (error) { log(`Failed to play sound: ${error}`); return { content: [{ type: 'text', text: 'Failed to play sound' }] }; } }
  • src/index.ts:27-56 (registration)
    Registers the playCompletionSound tool with the MCP server, providing the tool name, description, and inline handler function.
    server.tool( 'playCompletionSound', 'Plays a completion sound when called', async () => { try { // Play custom sound using a Promise to handle the callback properly await new Promise<void>((resolve, reject) => { audioPlayer.play(COMPLETION_SOUND, (err: Error | null) => { if (err) { log(`Error playing sound: ${err.message}`); reject(err); } else { log('Played completion sound successfully'); resolve(); } }); }); // Return proper JSON response return { content: [{ type: 'text', text: 'Played completion sound' }] }; } catch (error) { log(`Failed to play sound: ${error}`); return { content: [{ type: 'text', text: 'Failed to play sound' }] }; } } );
  • Initializes the audio player instance and defines the path to the completion sound file used by the handler.
    const audioPlayer = player(); // Use the custom sound file from the sounds directory const COMPLETION_SOUND = path.join(__dirname, '..', 'sounds', 'completion.mp3');

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/bcharleson/sound-mcp'

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