speech_to_speech
Convert audio files to different voices using ElevenLabs' voice transformation technology. Saves the modified audio to your computer for flexible voice customization.
Instructions
Transform audio from one voice to another using provided audio files. Saves output file to directory (default: $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
| Name | Required | Description | Default |
|---|---|---|---|
| input_file_path | Yes | ||
| voice_name | No | Adam | |
| output_directory | No |
Implementation Reference
- elevenlabs_mcp/server.py:891-930 (handler)The @mcp.tool decorator registers the speech_to_speech tool and defines its handler function, which converts input audio to speech in a target voice using the ElevenLabs speech_to_speech.convert API.@mcp.tool( description=f"""Transform audio from one voice to another using provided audio files. {get_output_mode_description(output_mode)}. ⚠️ 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, ) -> Union[TextContent, EmbeddedResource]: 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, "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) # Handle different output modes return handle_output_mode(audio_bytes, output_path, output_file_name, output_mode)