Skip to main content
Glama

comfy_list_models

Browse and filter available models, checkpoints, LoRAs, VAEs, and other resources in your ComfyUI models directory to select assets for AI image generation workflows.

Instructions

List available models, checkpoints, LoRAs, VAEs, and other resources in the ComfyUI models directory. Supports filtering by type and name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNo
filterNo
include_sizeNo

Implementation Reference

  • The main handler function that executes the logic for the 'comfy_list_models' tool. It processes the input, calls scanModelsDirectory to list models, applies filtering and size inclusion options, formats a summary, and returns a JSON-formatted text content response.
    export async function handleListModels(input: ListModelsInput) {
      try {
        const type = input.type || 'all';
        const filter = input.filter;
        const includeSize = input.include_size || false;
    
        // Scan models directory
        let models = scanModelsDirectory(type);
    
        // Apply filter
        if (filter) {
          const filterLower = filter.toLowerCase();
          models = models.filter(model =>
            model.name.toLowerCase().includes(filterLower)
          );
        }
    
        // Remove size if not requested
        if (!includeSize) {
          models = models.map(({ size, ...rest }) => rest) as any;
        }
    
        // Generate summary
        const summary = `Found ${models.length} model(s)${type !== 'all' ? ` of type ${type}` : ''}${filter ? ` matching "${filter}"` : ''}`;
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              models,
              total_count: models.length,
              summary
            }, null, 2)
          }]
        };
      } catch (error: any) {
        if (error.error) {
          return {
            content: [{
              type: "text",
              text: JSON.stringify(error, null, 2)
            }],
            isError: true
          };
        }
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify(ComfyUIErrorBuilder.executionError(error.message), null, 2)
          }],
          isError: true
        };
      }
    }
  • Zod schema defining the input parameters for the 'comfy_list_models' tool: optional 'type' enum for model category, 'filter' string, and 'include_size' boolean.
    export const ListModelsSchema = z.object({
      type: z.enum([
        "checkpoints",
        "loras",
        "vae",
        "clip",
        "clip_vision",
        "unet",
        "embeddings",
        "upscale_models",
        "diffusion_models",
        "controlnet",
        "ipadapter",
        "style_models",
        "photomaker",
        "insightface",
        "all"
      ]).optional(),
      filter: z.string().optional(),
      include_size: z.boolean().optional().default(false)
    });
  • src/server.ts:87-91 (registration)
    Tool registration in the MCP ListToolsRequestHandler, specifying the name, description, and inputSchema (derived from ListModelsSchema).
    {
      name: 'comfy_list_models',
      description: 'List available models, checkpoints, LoRAs, VAEs, and other resources in the ComfyUI models directory. Supports filtering by type and name.',
      inputSchema: zodToJsonSchema(ListModelsSchema) as any,
    },
  • src/server.ts:161-162 (registration)
    Dispatch case in the MCP CallToolRequestHandler that routes calls to 'comfy_list_models' to the handleListModels function.
    case 'comfy_list_models':
      return await handleListModels(args as any);
  • Core helper function that recursively scans the ComfyUI models directory subfolders for model files (matching extensions like .safetensors, .ckpt), collects ModelInfo objects with type, name, path, and size.
    export function scanModelsDirectory(type: string): ModelInfo[] {
      const config = getConfig();
      const basePath = getFullPath(config.paths.models);
    
      const typeMapping: Record<string, string> = {
        checkpoints: 'checkpoints',
        loras: 'loras',
        vae: 'vae',
        clip: 'clip',
        clip_vision: 'clip_vision',
        unet: 'unet',
        embeddings: 'embeddings',
        upscale_models: 'upscale_models',
        diffusion_models: 'diffusion_models',
        controlnet: 'controlnet',
        ipadapter: 'ipadapter',
        style_models: 'style_models',
        photomaker: 'photomaker',
        insightface: 'insightface'
      };
    
      const results: ModelInfo[] = [];
    
      const scanDir = (dir: string, modelType: string): void => {
        if (!existsSync(dir)) return;
    
        try {
          const files = readdirSync(dir);
          for (const file of files) {
            const fullPath = join(dir, file);
            const stat = statSync(fullPath);
    
            if (stat.isDirectory()) {
              scanDir(fullPath, modelType);
            } else {
              const ext = extname(file).toLowerCase();
              if (MODEL_EXTENSIONS.includes(ext)) {
                results.push({
                  type: modelType,
                  name: file,
                  path: fullPath.replace(basePath + '\\', ''),
                  size: stat.size
                });
              }
            }
          }
        } catch (error) {
          console.error(`Error scanning directory ${dir}:`, error);
        }
      };
    
      if (type === 'all') {
        for (const [key, subdir] of Object.entries(typeMapping)) {
          scanDir(join(basePath, subdir), key);
        }
      } else {
        const subdir = typeMapping[type];
        if (subdir) {
          scanDir(join(basePath, subdir), type);
        }
      }
    
      return results;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the tool lists resources and supports filtering, but does not disclose behavioral traits such as whether it's read-only, potential performance impacts, rate limits, or what the output format looks like (e.g., list structure, pagination). This leaves significant gaps for an agent to understand how to interact with it effectively.

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?

The description is front-loaded with the core purpose in the first sentence and adds supporting details in the second, with zero wasted words. It efficiently communicates key information without redundancy, making it easy for an agent to parse quickly.

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

Completeness2/5

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

Given the complexity of listing multiple resource types with filtering, no annotations, and no output schema, the description is incomplete. It lacks details on return values (e.g., format, fields), error handling, or prerequisites, which are crucial for an agent to use the tool correctly in a ComfyUI context. The description does not fully compensate for the missing structured data.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that parameters allow 'filtering by type and name,' which corresponds to the 'type' and 'filter' parameters, and implies resource listing. However, it does not detail the 'include_size' parameter or provide examples or constraints beyond what the schema's enum suggests. This partial compensation meets the baseline for low coverage.

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 clearly states the specific action ('List available models, checkpoints, LoRAs, VAEs, and other resources') and the location ('in the ComfyUI models directory'), distinguishing it from sibling tools like comfy_list_workflows which lists workflows rather than models. It uses precise terminology that matches the tool's name and scope.

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

Usage Guidelines3/5

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

The description implies usage by mentioning 'Supports filtering by type and name,' suggesting when to use it for filtered queries, but does not explicitly state when to choose this tool over alternatives or provide exclusions. No sibling tools directly overlap, but guidance on when to use this versus other listing tools is lacking.

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/Nikolaibibo/claude-comfyui-mcp'

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