clone_voice
Create custom voice profiles from audio samples for text-to-speech and speech-to-speech applications. Analyze MP3 or WAV files to generate voice replicas that match the characteristics of your audio input.
Instructions
[AllVoiceLab Tool] Create a custom voice profile by cloning from an audio sample.
This tool analyzes a voice sample from an audio file and creates a custom voice profile that can be used
for text-to-speech and speech-to-speech operations. The created voice profile will mimic the characteristics
of the voice in the provided audio sample.
Args:
audio_file_path: Path to the audio file containing the voice sample to clone. Only MP3 and WAV formats are supported. Maximum file size: 10MB.
name: Name to assign to the cloned voice profile. Required.
description: Optional description for the cloned voice profile.
Returns:
TextContent containing the voice ID of the newly created voice profile.
Limitations:
- Only MP3 and WAV formats are supported
- Maximum file size: 10MB (smaller than other audio tools)
- File must exist and be accessible
- Requires permission to use voice cloning feature
- Audio sample should contain clear speech with minimal background noise for best results
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| audio_file_path | Yes | ||
| name | Yes | ||
| description | No |
Implementation Reference
- allvoicelab_mcp/tools/speech.py:213-272 (handler)Implements the core logic for the clone_voice tool: validates input audio file and parameters, calls the AllVoiceLab client to create a new voice profile, handles errors like permissions and file not found, and returns the new voice ID.def clone_voice( audio_file_path: str, name: str, description: str = None ) -> TextContent: """ Create a custom voice profile by cloning from an audio sample Args: audio_file_path: Path to the audio file containing the voice sample to clone. Only MP3 and WAV formats are supported. Maximum file size: 10MB. name: Name to assign to the cloned voice profile. Required. description: Optional description for the cloned voice profile. Returns: TextContent: Contains the voice ID of the newly created voice profile. """ all_voice_lab = get_client() logging.info(f"Tool called: clone_voice") logging.info(f"Audio file path: {audio_file_path}") logging.info(f"Voice name: {name}") if description: logging.info(f"Voice description: {description}") # Validate audio file, using 10MB size limit is_valid, error_message = validate_audio_file(audio_file_path, max_size_mb=10) if not is_valid: return create_error_response(error_message) # Validate name parameter if not name: logging.warning("Name parameter is empty") return create_error_response("name parameter cannot be empty") try: logging.info("Starting voice cloning process") voice_id = all_voice_lab.add_voice(name, audio_file_path, description) logging.info(f"Voice cloning successful, voice ID: {voice_id}") return TextContent( type="text", text=f"Voice cloning completed. Your new voice ID is: {voice_id}\n" ) except VoiceCloneNoPermissionError as e: logging.error(f"Voice cloning failed: {str(e)}") return TextContent( type="text", text=f"Voice cloning failed, you don't have permission to clone voice. Please contact AllVoiceLab com." ) except FileNotFoundError as e: logging.error(f"Audio file does not exist: {audio_file_path}, error: {str(e)}") return TextContent( type="text", text=f"Audio file does not exist: {audio_file_path}" ) except Exception as e: logging.error(f"Voice cloning failed: {str(e)}") return TextContent( type="text", text=f"Voice cloning failed, tool temporarily unavailable" )
- allvoicelab_mcp/server.py:123-146 (registration)Registers the clone_voice tool with the MCP server using FastMCP's mcp.tool decorator, providing the tool name, detailed description including args and limitations (serving as schema), and binds it to the imported handler function.mcp.tool( name="clone_voice", description="""[AllVoiceLab Tool] Create a custom voice profile by cloning from an audio sample. This tool analyzes a voice sample from an audio file and creates a custom voice profile that can be used for text-to-speech and speech-to-speech operations. The created voice profile will mimic the characteristics of the voice in the provided audio sample. Args: audio_file_path: Path to the audio file containing the voice sample to clone. Only MP3 and WAV formats are supported. Maximum file size: 10MB. name: Name to assign to the cloned voice profile. Required. description: Optional description for the cloned voice profile. Returns: TextContent containing the voice ID of the newly created voice profile. Limitations: - Only MP3 and WAV formats are supported - Maximum file size: 10MB (smaller than other audio tools) - File must exist and be accessible - Requires permission to use voice cloning feature - Audio sample should contain clear speech with minimal background noise for best results """ )(clone_voice)
- allvoicelab_mcp/server.py:123-146 (schema)The tool description in the registration provides the input schema (arguments with types, descriptions, limitations) and output format.mcp.tool( name="clone_voice", description="""[AllVoiceLab Tool] Create a custom voice profile by cloning from an audio sample. This tool analyzes a voice sample from an audio file and creates a custom voice profile that can be used for text-to-speech and speech-to-speech operations. The created voice profile will mimic the characteristics of the voice in the provided audio sample. Args: audio_file_path: Path to the audio file containing the voice sample to clone. Only MP3 and WAV formats are supported. Maximum file size: 10MB. name: Name to assign to the cloned voice profile. Required. description: Optional description for the cloned voice profile. Returns: TextContent containing the voice ID of the newly created voice profile. Limitations: - Only MP3 and WAV formats are supported - Maximum file size: 10MB (smaller than other audio tools) - File must exist and be accessible - Requires permission to use voice cloning feature - Audio sample should contain clear speech with minimal background noise for best results """ )(clone_voice)