Skip to main content
Glama
disler
by disler

list_models

Find available AI models by matching a substring, enabling selection of appropriate models for specific coding tasks in the Aider MCP Server.

Instructions

List available models that match the provided substring

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
substringNoSubstring to match against available models

Implementation Reference

  • The core implementation of the list_models logic, wrapping the aider model matching functionality.
    def list_models(substring: str) -> List[str]:
        """
        List available models that match the provided substring.
        
        Args:
            substring (str): Substring to match against available models.
        
        Returns:
            List[str]: List of model names matching the substring.
        """
        return fuzzy_match_models(substring)
  • The MCP server request handler that extracts parameters and calls the list_models function.
    def process_list_models_request(params: Dict[str, Any]) -> Dict[str, Any]:
        """
        Process a list_models request.
    
        Args:
            params (Dict[str, Any]): The request parameters.
    
        Returns:
            Dict[str, Any]: The response data.
        """
        substring = params.get("substring", "")
    
        # Log the request details
        logger.info(f"List Models Request: Substring: '{substring}'")
    
        models = list_models(substring)
        logger.info(f"Found {len(models)} models matching '{substring}'")
    
        return {"models": models}
  • Definition of the Tool object for 'list_models' registered in the MCP server.
    LIST_MODELS_TOOL = Tool(
        name="list_models",
        description="List available models that match the provided substring",
        inputSchema={
            "type": "object",
            "properties": {
                "substring": {
                    "type": "string",
                    "description": "Substring to match against available models",
                }
            },
        },
    )
  • Data model definitions (Params, Response, Request) for the list_models tool.
    class ListModelsParams(BaseModel):
        """Parameters for the list_models tool."""
        substring: str = ""
    
    # Tool-specific response models
    class AICodeResponse(MCPResponse):
        """Response for the aider_ai_code tool."""
        status: str  # 'success' or 'failure'
        message: Optional[str] = None
    
    class ListModelsResponse(MCPResponse):
        """Response for the list_models tool."""
        models: List[str]
    
    # Specific request types
    class AICodeRequest(MCPRequest):
        """Request for the aider_ai_code tool."""
        name: str = "aider_ai_code"
        parameters: AICodeParams
    
    class ListModelsRequest(MCPRequest):
        """Request for the list_models tool."""
        name: str = "list_models"
        parameters: ListModelsParams
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/disler/aider-mcp-server'

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