list_models
Retrieve a comprehensive list of all downloaded Ollama models available on the MCP Ollama Server for easy access and management.
Instructions
List all downloaded Ollama models
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_ollama/server.py:20-38 (handler)Implementation of the 'list_models' tool handler. Decorated with @mcp.tool() which registers it. Uses ollama.list() to fetch models and formats their names, sizes, and modification times.@mcp.tool() async def list_models() -> str: """List all downloaded Ollama models""" try: models = ollama.list() if not models.get('models'): return "No models found" formatted_models = [] for model in models['models']: formatted_models.append( f"Name: {model.get('model', 'Unknown')}\n" f"Size: {model.get('size', 'Unknown')}\n" f"Modified: {model.get('modified_at', 'Unknown')}\n" "---" ) return "\n".join(formatted_models) except Exception as e: return f"Error listing models: {str(e)}"