Skip to main content
Glama
tijs

MCP Sound Tool

by tijs

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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"
        }
    } 
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses key behavioral traits: the tool copies default files to a user directory where they can be modified, implying it's a setup/initialization operation rather than a destructive modification. However, it doesn't mention potential side effects like overwriting existing files or permission requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections, front-loading the core purpose. Every sentence adds value: the initial statement defines the action, the bullet points provide usage guidance, and the final sentence explains the copying behavior. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has zero parameters, no annotations, but has an output schema, the description provides good context about what the tool does and when to use it. However, it doesn't mention what the output might contain (though the output schema handles this), and could benefit from mentioning potential side effects like file overwriting.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters (schema coverage 100%), so the baseline is 4. The description appropriately doesn't discuss parameters since none exist, maintaining focus on the tool's purpose and usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Install sound files') and target location ('to user's config directory'), distinguishing it from sibling tools like 'list_available_sounds' and 'play_sound'. It explicitly defines the verb+resource combination without being tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes a dedicated 'WHEN TO USE THIS TOOL' section with three explicit scenarios: customization, first-time setup, and troubleshooting missing files. This provides clear guidance on when to select this tool versus alternatives, though it doesn't explicitly mention when NOT to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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