list_models
List available checkpoints, LoRAs, samplers, schedulers, or upscalers from your ComfyUI instance to discover valid parameter values for other tools.
Instructions
List available models or samplers on the ComfyUI instance. Use this to discover valid values for the 'checkpoint' parameter of other tools, or to see what LoRAs and samplers are installed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | Which category of resource to list | checkpoints |
Implementation Reference
- src/tools/models.ts:21-35 (handler)The handler function for the 'list_models' tool. It calls fetchList() with the kind argument, formats the results, and returns them as text content.
async (args) => { const list = await fetchList(client, args.kind); const body = list.length > 0 ? list.map((n, i) => ` ${i + 1}. ${n}`).join("\n") : " (none found)"; return { content: [ { type: "text" as const, text: `${args.kind} (${list.length}):\n${body}`, }, ], }; }, - src/tools/models.ts:6-11 (schema)Zod schema for the 'list_models' tool input: a 'kind' enum field (checkpoints, loras, samplers, schedulers, upscalers) with a default of 'checkpoints'.
const listModelsSchema = { kind: z .enum(["checkpoints", "loras", "samplers", "schedulers", "upscalers"]) .default("checkpoints") .describe("Which category of resource to list"), }; - src/tools/models.ts:17-36 (registration)Registration of the 'list_models' tool via server.tool() in the registerModelTools function. Includes the tool name, description, schema, and handler.
server.tool( "list_models", "List available models or samplers on the ComfyUI instance. Use this to discover valid values for the 'checkpoint' parameter of other tools, or to see what LoRAs and samplers are installed.", listModelsSchema, async (args) => { const list = await fetchList(client, args.kind); const body = list.length > 0 ? list.map((n, i) => ` ${i + 1}. ${n}`).join("\n") : " (none found)"; return { content: [ { type: "text" as const, text: `${args.kind} (${list.length}):\n${body}`, }, ], }; }, ); - src/server.ts:40-52 (registration)Registration caller: registerModelTools is invoked at server build time (line 45) to register the 'list_models' tool on the MCP server.
const buildServer = () => { const s = new McpServer({ name: "comfyui-mcp", version: "0.2.0" }); registerGenerateTools(s, client); registerRefineTool(s, client); registerUpscaleTool(s, client); registerModelTools(s, client); registerImageTools(s, client); registerConditioningTools(s, client); registerTemplateTools(s, client, templateStore); return s; }; return { client, buildServer }; } - src/tools/models.ts:58-74 (helper)Helper function fetchList() that dispatches to the appropriate ComfyUIClient method based on the kind parameter: listCheckpoints, listLoras, listSamplers, listSchedulers, or listUpscaleModels.
async function fetchList( client: ComfyUIClient, kind: "checkpoints" | "loras" | "samplers" | "schedulers" | "upscalers", ): Promise<string[]> { switch (kind) { case "checkpoints": return client.listCheckpoints(); case "loras": return client.listLoras(); case "samplers": return client.listSamplers(); case "schedulers": return client.listSchedulers(); case "upscalers": return client.listUpscaleModels(); } }