list_available_sounds
Discover all available notification sounds for audio feedback. Check which sound options exist before selecting a custom sound.
Instructions
List all available notification sounds.
WHEN TO USE THIS TOOL:
- When you need to check what sound options are available
- When determining if a specific sound file exists
- Before using a custom sound to verify available options
This tool helps you discover what sounds are available for providing audio feedback.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/sound_tool/server.py:175-183 (handler)The actual handler function for the 'list_available_sounds' tool. It lists .mp3 and .wav files from self.sounds_dir using os.listdir and returns them as a formatted string.
def list_available_sounds() -> str: try: sounds = [f for f in os.listdir(self.sounds_dir) if f.endswith(('.mp3', '.wav'))] if sounds: return "Available sounds:\n" + "\n".join(sounds) else: return "No sound files found in the sounds directory." except Exception as e: return f"Error listing sounds: {e}" - The schema/tool definition for 'list_available_sounds'. Defines name, description, parameters (empty object), and return type.
list_sounds_tool_definition = { "name": "list_available_sounds", "description": """ List all available notification sounds. Use this tool when you need to check what sound options are available to play. This is helpful when determining what custom sounds might be available. """, "parameters": { "type": "object", "properties": {}, "required": [] }, "returns": { "type": "string", "description": "A string listing all available sound files" } } - src/sound_tool/server.py:165-183 (registration)The tool is registered via the @self.mcp.tool() decorator inside SoundToolServer.register_tools() method (line 118). The decorator wraps list_available_sounds with description metadata.
@self.mcp.tool(description=""" List all available notification sounds. WHEN TO USE THIS TOOL: - When you need to check what sound options are available - When determining if a specific sound file exists - Before using a custom sound to verify available options This tool helps you discover what sounds are available for providing audio feedback. """) def list_available_sounds() -> str: try: sounds = [f for f in os.listdir(self.sounds_dir) if f.endswith(('.mp3', '.wav'))] if sounds: return "Available sounds:\n" + "\n".join(sounds) else: return "No sound files found in the sounds directory." except Exception as e: return f"Error listing sounds: {e}" - src/sound_tool/server.py:80-88 (helper)The __init__ method of SoundToolServer also calls register_tools() which registers list_available_sounds. The sounds_dir attribute used by the handler is initialized earlier in __init__ (lines 52-76).
# Log available sounds for reference try: sounds = [f for f in os.listdir(self.sounds_dir) if f.endswith(('.mp3', '.wav'))] print(f"Available sounds: {', '.join(sounds)}") except Exception: pass # Register tools self.register_tools()