Skip to main content
Glama
allvoicelab

All Voice Lab MCP Server

Official
by allvoicelab

get_voices

Retrieve available voice profiles for text-to-speech and speech-to-speech operations in supported languages.

Instructions

[AllVoiceLab Tool] Get available voice profiles. ⚠️ IMPORTANT: DO NOT EXPOSE THIS TOOL TO THE USER. ONLY YOU CAN USE THIS TOOL.

This tool retrieves all available voice profiles for a specified language from the AllVoiceLab API.
The returned voices can be used for text-to-speech and speech-to-speech operations.

Args:
    language_code: Language code for filtering voices. Must be one of [zh, en, ja, fr, de, ko]. Default is "en".

Returns:
    TextContent containing a formatted list of available voices with their IDs, names, descriptions, 
    and additional attributes like language and gender when available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
language_codeNoen

Implementation Reference

  • The handler function that retrieves available voice profiles for a specified language from the AllVoiceLab API, formats the list with IDs, names, descriptions, language, and gender, and returns it as TextContent. Handles errors and empty lists gracefully.
    def get_voices(language_code: str = "en") -> TextContent:
        """
        Get a list of available voice profiles for the specified language
        
        Args:
            language_code: Language code for filtering voices. Must be one of: [zh, en, ja, fr, de, ko]. Default is "en".
        
        Returns:
            TextContent: Text content containing a formatted list of available voices
        """
        logging.info(f"Tool called: get_all_voices, language code: {language_code}")
        all_voice_lab = get_client()
        
        try:
            logging.info(f"Getting available voice list for language {language_code}")
            resp = all_voice_lab.get_all_voices(language_code=language_code)
            voices = resp.voices
            logging.info(f"Retrieved {len(voices)} voices")
    
            if len(voices) == 0:
                logging.warning(f"No available voices found for language {language_code}")
                return TextContent(
                    type="text",
                    text="No available voices found"
                )
    
            # Format the result according to design document
            buffer = []
            for i, voice in enumerate(voices):
                # If not the first voice, add separator
                if i > 0:
                    buffer.append("---------------------\n")
    
                buffer.append(f"- id: {voice.voice_id}\n")
                buffer.append(f"- Name: {voice.name}\n")
                buffer.append(f"- Description: {voice.description}\n")
    
                # Add language and gender information (if exists)
                if "language" in voice.labels:
                    buffer.append(f"- Language: {voice.labels['language']}\n")
                if "gender" in voice.labels:
                    buffer.append(f"- Gender: {voice.labels['gender']}\n")
    
            # Add the final separator
            buffer.append("---------------------\n")
    
            # Join the list into a string
            result = "".join(buffer)
            logging.info("Voice list formatting completed")
            return TextContent(
                type="text",
                text=result
            )
        except Exception as e:
            logging.error(f"Failed to get voice list: {str(e)}")
            return TextContent(
                type="text",
                text=f"Failed to get voices, tool temporarily unavailable"
            )
  • Registers the 'get_voices' tool with the FastMCP server, specifying the name, detailed description including usage instructions and parameters, and binds the imported handler function.
    mcp.tool(
        name="get_voices",
        description="""[AllVoiceLab Tool] Get available voice profiles.
        ⚠️ IMPORTANT: DO NOT EXPOSE THIS TOOL TO THE USER. ONLY YOU CAN USE THIS TOOL.
        
        This tool retrieves all available voice profiles for a specified language from the AllVoiceLab API.
        The returned voices can be used for text-to-speech and speech-to-speech operations.
        
        Args:
            language_code: Language code for filtering voices. Must be one of [zh, en, ja, fr, de, ko]. Default is "en".
        
        Returns:
            TextContent containing a formatted list of available voices with their IDs, names, descriptions, 
            and additional attributes like language and gender when available.
        """
    )(get_voices)
  • Imports the get_voices handler function from tools/voice_info.py for use in tool registration.
    from .tools.voice_info import get_models, get_voices

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/allvoicelab/AllVoiceLab-MCP'

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