Skip to main content
Glama
ps.ts1.01 kB
import type { Ollama } from 'ollama'; import { ResponseFormat } from '../types.js'; import { formatResponse } from '../utils/response-formatter.js'; import type { ToolDefinition } from '../autoloader.js'; import { PsInputSchema } from '../schemas.js'; /** * List running models */ export async function listRunningModels( ollama: Ollama, format: ResponseFormat ): Promise<string> { const response = await ollama.ps(); return formatResponse(JSON.stringify(response), format); } export const toolDefinition: ToolDefinition = { name: 'ollama_ps', description: 'List running models. Shows which models are currently loaded in memory.', inputSchema: { type: 'object', properties: { format: { type: 'string', enum: ['json', 'markdown'], default: 'json', }, }, }, handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => { PsInputSchema.parse(args); return listRunningModels(ollama, format); }, };

Implementation Reference

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

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