Skip to main content
Glama

speech_to_speech

Convert audio files from one voice to another using ElevenLabs voice transformation technology. Provide an input audio file and specify the target voice to generate new audio output.

Instructions

Transform audio from one voice to another using provided audio files.

⚠️ 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
voice_nameNoAdam

Implementation Reference

  • The speech_to_speech tool handler: transforms input audio file to speech in the specified voice using ElevenLabs client.speech_to_speech.convert, saves output MP3 file.
    @mcp.tool( description="""Transform audio from one voice to another using provided audio files. ⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user. """ ) def speech_to_speech( input_file_path: str, voice_name: str = "Adam", output_directory: str | None = None, ) -> TextContent: voices = client.voices.search(search=voice_name) if len(voices.voices) == 0: make_error("No voice found with that name.") voice = next((v for v in voices.voices if v.name == voice_name), None) if voice is None: make_error(f"Voice with name: {voice_name} does not exist.") assert voice is not None # Type assertion for type checker file_path = handle_input_file(input_file_path) output_path = make_output_path(output_directory, base_path) output_file_name = make_output_file("sts", file_path.name, output_path, "mp3") with file_path.open("rb") as f: audio_bytes = f.read() audio_data = client.speech_to_speech.convert( model_id="eleven_multilingual_sts_v2", voice_id=voice.voice_id, 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