Skip to main content
Glama

isolate_audio

Extract and save isolated audio from any file using ElevenLabs API. Specify input file path and optional output directory to separate audio content.

Instructions

Isolate audio from a file and save the output audio file to a given directory. Directory is optional, if not provided, the output file will be saved to $HOME/Desktop.

⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_file_pathYes
output_directoryNo

Implementation Reference

  • The @mcp.tool decorator registers the 'isolate_audio' tool, including its description which implies the input schema (input_file_path: str, output_directory: str | None = None).
        description="""Isolate audio from a file and save the output audio file to a given directory.
        Directory is optional, if not provided, the output file will be saved to $HOME/Desktop.
    
        ⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user.
        """
    )
  • The core implementation of the 'isolate_audio' tool. It processes the input audio file, calls the ElevenLabs client.audio_isolation.convert API to isolate the audio, saves the result to an output file, and returns a success message with the file path.
    def isolate_audio(
        input_file_path: str, output_directory: str | None = None
    ) -> TextContent:
        file_path = handle_input_file(input_file_path)
        output_path = make_output_path(output_directory, base_path)
        output_file_name = make_output_file("iso", file_path.name, output_path, "mp3")
        with file_path.open("rb") as f:
            audio_bytes = f.read()
        audio_data = client.audio_isolation.convert(
            audio=audio_bytes,
        )
        audio_bytes = b"".join(audio_data)
    
        with open(output_path / output_file_name, "wb") as f:
            f.write(audio_bytes)
    
        return TextContent(
            type="text",
            text=f"Success. File saved as: {output_path / output_file_name}",
        )

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/projectservan8n/elevenlabs-mcp'

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