Skip to main content
Glama

list_asr_models

Discover available speech recognition models and their features to select the right one for your audio transcription needs.

Instructions

List all available ASR models and their capabilities.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
typeYes
_metaNo
annotationsNo

Implementation Reference

  • The primary handler implementation for the 'list_asr_models' MCP tool. It is registered via the @mcp.tool decorator (which also serves as schema definition with no input parameters). The function fetches ASR models from the WhissleClient, handles various response formats, implements retry logic using handle_api_error, and returns a formatted TextContent.
    @mcp.tool(
        description="List all available ASR models and their capabilities."
    )
    def list_asr_models() -> TextContent:
        """List all available ASR models.
    
        Returns:
            TextContent with a formatted list of available models
        """
        try:
            logger.info("Fetching available ASR models...")
            
            retry_count = 0
            max_retries = 2  # Increased from 1 to 2
            
            while retry_count <= max_retries:
                try:
                    logger.info(f"Attempting to list models (Attempt {retry_count+1}/{max_retries+1})")
                    models = client.list_asr_models()
                    
                    if not models:
                        logger.error("No models were returned from the API")
                        return make_error("No models were returned from the API")
    
                    # Handle both string and object responses
                    if isinstance(models, list):
                        if all(isinstance(model, str) for model in models):
                            # If models is a list of strings
                            model_list = "\n".join(f"Model: {model}" for model in models)
                        else:
                            # If models is a list of objects with name and description
                            model_list = "\n".join(
                                f"Model: {model.name}\nDescription: {model.description}\n"
                                for model in models
                            )
                    else:
                        logger.error("Unexpected response format from API")
                        return make_error("Unexpected response format from API")
    
                    logger.info("Successfully retrieved ASR models")
                    return TextContent(
                        type="text",
                        text=f"Available ASR Models:\n\n{model_list}",
                    )
                except Exception as api_error:
                    error_msg = str(api_error)
                    logger.error(f"Error listing models: {error_msg}")
                    
                    # Handle API errors with retries
                    error_result = handle_api_error(error_msg, "listing models", retry_count, max_retries)
                    if error_result is not None:  # If we should not retry
                        return error_result  # Return the error message
                    
                    retry_count += 1
            
            # If we get here, all retries failed
            logger.error(f"All attempts to list models failed after {max_retries+1} attempts")
            return make_error(f"Failed to list ASR models after {max_retries+1} attempts")
        except Exception as e:
            logger.error(f"Unexpected error listing ASR models: {str(e)}")
            return make_error(f"Failed to list ASR models: {str(e)}")
  • Shared helper function used by list_asr_models (and other tools) for handling API errors with retry logic for HTTP 500 errors and specific error messages for other status codes.
    def handle_api_error(error_msg, operation_name, retry_count=0, max_retries=2):
        """Helper function to handle API errors with retries and better error messages"""
        logger.error(f"API error during {operation_name}: {error_msg}")
        
        if "HTTP 500" in error_msg:
            if retry_count < max_retries:
                # Exponential backoff: 2, 4, 8 seconds
                wait_time = 2 ** (retry_count + 1)
                logger.info(f"HTTP 500 error during {operation_name}. Retrying in {wait_time} seconds... (Attempt {retry_count+1}/{max_retries+1})")
                time.sleep(wait_time)
                return None  # Signal to retry
            else:
                # Provide more detailed error message for upload issues
                if "uploading file" in error_msg.lower():
                    return make_error(
                        f"Server error during {operation_name}. The file upload to the Whissle API failed. "
                        f"This could be due to:\n"
                        f"1. Temporary server issues\n"
                        f"2. File format compatibility issues\n"
                        f"3. Network connectivity problems\n"
                        f"Please try again later or contact Whissle support. Error: {error_msg}"
                    )
                else:
                    return make_error(
                        f"Server error during {operation_name}. This might be a temporary issue with the Whissle API. "
                        f"Please try again later or contact Whissle support. Error: {error_msg}"
                    )
        elif "HTTP 413" in error_msg:
            return make_error(f"File too large. Please try a smaller file. Error: {error_msg}")
        elif "HTTP 415" in error_msg:
            return make_error(f"Unsupported file format. Please use a supported format. Error: {error_msg}")
        elif "HTTP 401" in error_msg or "HTTP 403" in error_msg:
            return make_error(f"Authentication error. Please check your API token. Error: {error_msg}")
        else:
            return make_error(f"API error during {operation_name}: {error_msg}")
  • Utility helper from utils.py imported and used in list_asr_models for creating standardized error responses.
    def make_error(message: str) -> None:
        """Raise an error with a message."""
        raise ValueError(message)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'List' implies a read-only operation, the description doesn't specify whether this requires authentication, what format the capabilities are returned in, if there are rate limits, or if the list is static or dynamic. For a tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any fluff. It's front-loaded with the core action ('List all available ASR models') and adds necessary detail ('and their capabilities'). Every word earns its place, making it highly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (0 parameters) and the presence of an output schema (which should document the return values), the description is minimally adequate. However, it lacks context about when to use it relative to siblings and behavioral details not covered by annotations (which are absent). This makes it incomplete for optimal agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so there are no parameters to document. The description appropriately doesn't mention any parameters, which is correct for this case. Baseline 4 is applied as per the rules for 0 parameters, since no additional parameter semantics are needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all available ASR models and their capabilities'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'speech_to_text' which might also involve ASR models, though the distinction is somewhat implied by the listing vs. processing focus.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention whether this should be used for discovery before invoking 'speech_to_text', or if it's for administrative purposes. With sibling tools like 'diarize_speech' and 'speech_to_text' that likely use ASR models, the lack of contextual guidance is a notable gap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/WhissleAI/whissle-mcp'

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