list_models
Retrieve details of locally-installed Ollama models, including name, size, family, parameter size, and quantization level.
Instructions
List locally-installed models: name, size in bytes, digest, modified timestamp, family (e.g. llama), parameter size (e.g. 8.0B), and quantization level (e.g. Q4_K_M).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:130-143 (handler)The handler function that executes the list_models tool logic. It calls Ollama's GET /api/tags endpoint, maps the response to include model name, size, digest, modified_at, family, parameter_size, and quantization_level, then returns the results as text.
async function listModels() { const r = await httpRequest('GET', '/api/tags'); if (r.error) return errorResult(r.error); const models = (r.data?.models || []).map((m) => ({ name: m.name, size_bytes: m.size, digest: m.digest, modified_at: m.modified_at, family: m.details?.family || null, parameter_size: m.details?.parameter_size || null, quantization_level: m.details?.quantization_level || null, })); return textResult({ count: models.length, models }); } - server.js:282-287 (schema)The tool registration definition in the TOOLS array for list_models, including its name, description, annotations (readOnlyHint: true), and inputSchema (no parameters required, empty properties object).
{ name: 'list_models', description: 'List locally-installed models: name, size in bytes, digest, modified timestamp, family (e.g. llama), parameter size (e.g. 8.0B), and quantization level (e.g. Q4_K_M).', annotations: { title: 'List installed models', readOnlyHint: true, destructiveHint: false, openWorldHint: false }, inputSchema: { type: 'object', properties: {}, additionalProperties: false }, }, - server.js:385-394 (registration)The HANDLERS mapping object that maps the string 'list_models' to the listModels function, used at dispatch time in the tools/call handler.
const HANDLERS = { ollama_status: ollamaStatus, list_models: listModels, list_running: listRunning, show_model: showModel, generate: generate, chat: chat, pull_model: pullModel, delete_model: deleteModel, }; - server.js:410-410 (registration)The tools/list handler that serves the TOOLS array (including list_models) to clients during MCP capability negotiation.
if (method === 'tools/list') { respond(id, { tools: TOOLS }); return; } - server.js:49-54 (helper)The textResult helper function used by listModels to wrap the response in the standard MCP content format.
function textResult(obj) { return { content: [{ type: 'text', text: JSON.stringify(obj, null, 2) }] }; } function errorResult(message) { return { content: [{ type: 'text', text: message }], isError: true }; }