Skip to main content
Glama

list_running

Read-only

Lists Ollama models currently loaded in VRAM, showing size, VRAM usage, and expiry. Returns empty list when idle.

Instructions

List models currently loaded into VRAM with their size, VRAM footprint, and expiry timestamp. Empty list means Ollama is idle.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_running' tool. Calls Ollama's /api/ps endpoint and returns a list of running models with their name, size, VRAM footprint, expiry, and digest.
    async function listRunning() {
      const r = await httpRequest('GET', '/api/ps');
      if (r.error) return errorResult(r.error);
      const models = (r.data?.models || []).map((m) => ({
        name: m.name,
        size_bytes: m.size,
        size_vram_bytes: m.size_vram,
        expires_at: m.expires_at,
        digest: m.digest,
      }));
      return textResult({ count: models.length, models });
    }
  • The tool registration schema for 'list_running' defining its name, description, annotations (read-only hint), and inputSchema (empty object, no parameters).
      name: 'list_running',
      description: 'List models currently loaded into VRAM with their size, VRAM footprint, and expiry timestamp. Empty list means Ollama is idle.',
      annotations: { title: 'List running models', readOnlyHint: true, destructiveHint: false, openWorldHint: false },
      inputSchema: { type: 'object', properties: {}, additionalProperties: false },
    },
  • server.js:385-394 (registration)
    The HANDLERS map that maps tool name 'list_running' to the listRunning function, used by the JSON-RPC dispatch to route tools/call requests.
    const HANDLERS = {
      ollama_status: ollamaStatus,
      list_models: listModels,
      list_running: listRunning,
      show_model: showModel,
      generate: generate,
      chat: chat,
      pull_model: pullModel,
      delete_model: deleteModel,
    };
  • The httpRequest helper function used by listRunning to make the GET request to Ollama's /api/ps endpoint.
    function httpRequest(method, path, body) {
      return new Promise((resolve) => {
        let url;
        try {
          url = new URL(path, OLLAMA_URL);
        } catch (e) {
          resolve({ error: `invalid URL: ${e.message}` });
          return;
        }
        const lib = url.protocol === 'https:' ? https : http;
        const opts = {
          method,
          hostname: url.hostname,
          port: url.port || (url.protocol === 'https:' ? 443 : 80),
          path: url.pathname + url.search,
          headers: { 'accept': 'application/json' },
        };
        let bodyBuf = null;
        if (body !== undefined) {
          bodyBuf = Buffer.from(JSON.stringify(body), 'utf8');
          opts.headers['content-type'] = 'application/json';
          opts.headers['content-length'] = bodyBuf.length;
        }
        const req = lib.request(opts, (res) => {
          let chunks = Buffer.alloc(0);
          res.on('data', (d) => { chunks = Buffer.concat([chunks, d]); });
          res.on('end', () => {
            const text = chunks.toString('utf8');
            if (res.statusCode >= 400) {
              resolve({ status: res.statusCode, error: `HTTP ${res.statusCode}: ${text.slice(0, 500)}` });
              return;
            }
            // Some endpoints return text/plain (e.g. GET /); try JSON first, fall back to text.
            try { resolve({ status: res.statusCode, data: JSON.parse(text) }); }
            catch (_) { resolve({ status: res.statusCode, data: null, text }); }
          });
        });
        req.setTimeout(REQUEST_TIMEOUT_MS, () => {
          req.destroy(new Error(`request timed out after ${REQUEST_TIMEOUT_MS}ms`));
        });
        req.on('error', (e) => {
          // Give a friendly connection-refused message.
          const msg = /ECONNREFUSED|ENOTFOUND/.test(e.code || e.message)
            ? `cannot reach Ollama at ${OLLAMA_URL} — is the server running? Start it with \`ollama serve\` or open the Ollama app.`
            : e.message;
          resolve({ error: msg });
        });
        if (bodyBuf) req.write(bodyBuf);
        req.end();
      });
    }
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds that the tool returns specific fields (size, VRAM footprint, expiry timestamp), enhancing transparency beyond annotations.

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?

Single sentence, front-loaded with verb, no wasted words. Achieves maximum clarity with minimal text.

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

Completeness5/5

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

Fully describes the tool's function and output given the lack of parameters and output schema. The note about empty list provides complete context for the return value.

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?

No parameters defined; the description does not need to add parameter details. Baseline score of 4 applies as there are no parameters to describe.

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

Purpose5/5

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

The description uses a specific verb ('List') and resource ('models currently loaded into VRAM'), and distinguishes from sibling 'list_models' by specifying the loading status. It also mentions the returned fields (size, VRAM footprint, expiry timestamp).

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

Usage Guidelines4/5

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

The description implies usage for checking current VRAM load and idle status ('Empty list means Ollama is idle'), but does not explicitly mention when to use it vs alternatives like 'list_models' or 'ollama_status'.

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/LukeLamb/claude-ollama-mcp'

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