play_info_sound
Enable AI assistants to play macOS system informational sounds for clear and immediate audio feedback, enhancing user interaction and response understanding.
Instructions
Play an informational system sound
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:348-357 (handler)Handler for the 'play_info_sound' tool. Calls playSound('info') which plays the 'Glass' system sound using afplay, and returns a success message.case 'play_info_sound': await playSound('info'); return { content: [ { type: 'text', text: 'Info sound played successfully', }, ], };
- src/index.ts:279-287 (registration)Registration of the 'play_info_sound' tool in the ListTools handler, including its name, description, and empty input schema (no parameters required).{ name: 'play_info_sound', description: 'Play an informational system sound', inputSchema: { type: 'object', properties: {}, required: [], }, },
- src/index.ts:282-286 (schema)Input schema for 'play_info_sound' tool: an empty object (no input parameters).inputSchema: { type: 'object', properties: {}, required: [], },
- src/index.ts:96-149 (helper)Helper function that implements the core logic for playing simple system sounds ('info' maps to 'Glass.aiff', etc.) using child_process.spawn('afplay') with throttling and timeout.async function playSound(soundType: 'info' | 'warning' | 'error'): Promise<void> { const requestId = `${soundType}-${Date.now()}`; // Throttle requests to prevent conflicts if (activeRequests.has(soundType)) { throw new Error(`${soundType} sound already playing`); } activeRequests.add(soundType); try { return new Promise((resolve, reject) => { let soundName: string; switch (soundType) { case 'info': soundName = 'Glass'; break; case 'warning': soundName = 'Purr'; break; case 'error': soundName = 'Sosumi'; break; default: soundName = 'Glass'; } const afplay = spawn('afplay', [`/System/Library/Sounds/${soundName}.aiff`]); // Add timeout const timeout = setTimeout(() => { afplay.kill(); reject(new Error('Sound playback timed out')); }, PROCESS_TIMEOUT_MS); afplay.once('close', (code) => { clearTimeout(timeout); if (code === 0) { resolve(); } else { reject(new Error(`Sound playback failed with code ${code}`)); } }); afplay.once('error', (error) => { clearTimeout(timeout); reject(error); }); }); } finally { activeRequests.delete(soundType); } }