list
Discover and access all available AI models locally using this tool, enabling efficient management and interaction within the Ollama MCP Server framework.
Instructions
List all models in Ollama
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:36-43 (handler)Handler function for the 'list' tool: calls ollama.list(), returns JSON-formatted result or error.async () => { try { const result = await ollama.list(); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${formatError(error)}` }], isError: true }; } }
- src/index.ts:31-35 (schema)Input schema and metadata for the 'list' tool (empty input schema).{ title: "List models", description: "List all models in Ollama", inputSchema: {}, },
- src/index.ts:29-44 (registration)Full registration of the 'list' tool using server.registerTool.server.registerTool( "list", { title: "List models", description: "List all models in Ollama", inputSchema: {}, }, async () => { try { const result = await ollama.list(); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${formatError(error)}` }], isError: true }; } } );
- src/index.ts:17-19 (helper)Helper function formatError used in the 'list' tool handler for error messages.// Helper for error formatting const formatError = (error: unknown): string => error instanceof Error ? error.message : String(error);