Skip to main content
Glama

install_to_user_dir

Copy default sound files to your configuration directory for customization, initial setup, or troubleshooting missing audio in MCP Sound Tool.

Instructions

Install sound files to user's config directory. WHEN TO USE THIS TOOL: - When the user wants to customize the sound files - When setting up the sound tool for the first time - When troubleshooting missing sound files This tool copies the default sound files to the user's configuration directory where they can be modified or replaced with custom sounds.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'install_to_user_dir' tool, decorated as an MCP tool. It calls the helper to copy sounds and returns success/error message.
    def install_to_user_dir() -> str: try: user_dir = self.copy_sounds_to_user_dir() return f"Sound files installed to {user_dir}" except Exception as e: return f"Error installing sound files: {e}"
  • Supporting helper function that implements the core logic of copying bundled sound files to the user's configuration directory (~/.config/mcp-sound-tool/sounds), with fallbacks for different Python versions.
    def copy_sounds_to_user_dir(self): """Copy bundled sounds to user config directory.""" user_sounds_dir = os.path.join(os.path.expanduser("~"), ".config", "mcp-sound-tool", "sounds") os.makedirs(user_sounds_dir, exist_ok=True) # Get list of sound files try: # Try with Python 3.9+ method sound_files = resources.files("sound_tool").joinpath("sounds").iterdir() for sound_file in sound_files: if sound_file.name.endswith((".mp3", ".wav")): shutil.copy(sound_file, os.path.join(user_sounds_dir, sound_file.name)) except (AttributeError, ImportError): # Fallback for older Python sounds_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "sounds") if os.path.exists(sounds_dir): for sound_file in os.listdir(sounds_dir): if sound_file.endswith((".mp3", ".wav")): shutil.copy( os.path.join(sounds_dir, sound_file), os.path.join(user_sounds_dir, sound_file) ) return user_sounds_dir
  • The registration of the 'install_to_user_dir' tool using the @self.mcp.tool decorator within the register_tools method.
    @self.mcp.tool(description=""" Install sound files to user's config directory. WHEN TO USE THIS TOOL: - When the user wants to customize the sound files - When setting up the sound tool for the first time - When troubleshooting missing sound files This tool copies the default sound files to the user's configuration directory where they can be modified or replaced with custom sounds. """) def install_to_user_dir() -> str: try: user_dir = self.copy_sounds_to_user_dir() return f"Sound files installed to {user_dir}" except Exception as e: return f"Error installing sound files: {e}"
  • Schema definition for the 'install_to_user_dir' tool, including name, description, parameters (none), and returns.
    install_tool_definition = { "name": "install_to_user_dir", "description": """ Install sound files to user's config directory. This tool should be used when the user wants to install the default sound files to their config directory for customization. """, "parameters": { "type": "object", "properties": {}, "required": [] }, "returns": { "type": "string", "description": "A message indicating the result of the operation" } }

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

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