Skip to main content
Glama

list_templates

Browse and filter available workflow templates by category, difficulty level, or tags to find ready-to-use solutions for common ComfyUI tasks.

Instructions

List available workflow templates.

Discover workflow templates by category, difficulty, or tags. Templates provide ready-to-use workflows for common use cases.

Args: category: Filter by category (Generation, Enhancement, Editing, etc.) difficulty: Filter by difficulty (beginner, intermediate, advanced) tag: Filter by tag (text2img, inpainting, controlnet, etc.)

Returns: List of template metadata with names, descriptions, and parameters

Examples: list_templates() list_templates(category="Generation") list_templates(difficulty="beginner") list_templates(tag="text2img")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo
difficultyNo
tagNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'list_templates' MCP tool. Decorated with @mcp.tool for registration. Accepts optional filters for category, difficulty, and tag, then delegates to template_manager.search_templates and returns the filtered list of templates.
    @mcp.tool
    def list_templates(
        category: str = None,
        difficulty: str = None,
        tag: str = None
    ) -> list[dict]:
        """List available workflow templates.
        
        Discover workflow templates by category, difficulty, or tags.
        Templates provide ready-to-use workflows for common use cases.
        
        Args:
            category: Filter by category (Generation, Enhancement, Editing, etc.)
            difficulty: Filter by difficulty (beginner, intermediate, advanced)
            tag: Filter by tag (text2img, inpainting, controlnet, etc.)
        
        Returns:
            List of template metadata with names, descriptions, and parameters
        
        Examples:
            list_templates()
            list_templates(category="Generation")
            list_templates(difficulty="beginner")
            list_templates(tag="text2img")
        """
        try:
            # Convert filters to search parameters
            tags = [tag] if tag else None
            
            results = template_manager.search_templates(
                category=category,
                tags=tags,
                difficulty=difficulty
            )
            
            return results
            
        except Exception as e:
            raise ToolError(f"Error listing templates: {e}")
  • Core filtering logic in TemplateManager.search_templates, directly invoked by the list_templates tool handler to apply category, tags, and difficulty filters to the full list of templates (custom and official).
    def search_templates(
        self, 
        query: Optional[str] = None,
        category: Optional[str] = None,
        tags: Optional[List[str]] = None,
        difficulty: Optional[str] = None,
        source: Optional[str] = None,
        include_official: bool = True
    ) -> List[Dict[str, Any]]:
        """Search templates by various criteria."""
        # Get all templates first
        all_templates = self.list_templates(include_official=include_official)
        results = []
        
        for template_data in all_templates:
            # Check source filter
            if source and template_data.get("source") != source:
                continue
                
            # Check query match (name, description, category)
            if query:
                query_lower = query.lower()
                if not any([
                    query_lower in template_data["name"].lower(),
                    query_lower in template_data["description"].lower(),
                    query_lower in template_data["category"].lower(),
                ]):
                    # For custom templates, also check tags
                    if template_data.get("source") == "custom" and "tags" in template_data:
                        if not any(query_lower in tag.lower() for tag in template_data["tags"]):
                            continue
                    else:
                        continue
            
            # Check category
            if category and template_data["category"].lower() != category.lower():
                continue
            
            # Check tags (only for custom templates)
            if tags and template_data.get("source") == "custom":
                template_tags = template_data.get("tags", [])
                if not any(tag.lower() in [t.lower() for t in template_tags] for tag in tags):
                    continue
            
            # Check difficulty (only for custom templates)
            if difficulty and template_data.get("difficulty"):
                if template_data["difficulty"].lower() != difficulty.lower():
                    continue
            
            results.append(template_data)
        
        return results
  • TemplateManager.list_templates method that aggregates custom templates and official templates into a unified list with metadata, used as the base for searching and filtering.
    def list_templates(self, include_official: bool = True) -> List[Dict[str, Any]]:
        """List all available templates with metadata."""
        results = []
        
        # Add custom templates
        for name, template in self.custom_templates.items():
            results.append({
                "name": name,
                "description": template.description,
                "category": template.category,
                "tags": template.tags,
                "difficulty": template.difficulty,
                "required_models": template.required_models or [],
                "parameters": template.parameters or {},
                "source": "custom"
            })
        
        # Add official templates if requested
        if include_official and official_manager.templates:
            official_templates = official_manager.list_templates()
            results.extend(official_templates)
        
        return results
  • OfficialTemplateManager.list_templates provides metadata for official templates from Comfy-Org repo, integrated into the main template list by TemplateManager.
    def list_templates(self) -> List[Dict[str, Any]]:
        """List all official templates with metadata."""
        return [
            {
                "name": name,
                "display_name": template.name,
                "description": template.description,
                "category": template.category,
                "source": "official",
                "preview_images": template.preview_images or [],
                "source_url": template.source_url,
                "has_dsl": template.dsl_content is not None
            }
            for name, template in self.templates.items()
        ]
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions that templates 'provide ready-to-use workflows' and returns 'List of template metadata', but lacks details on permissions, rate limits, pagination, or whether it's read-only. For a list tool with no annotations, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with purpose statement, usage context, parameter details, return info, and examples. Each section adds value, though it could be slightly more front-loaded by moving examples later. Overall efficient with minimal waste.

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

Completeness4/5

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

Given 3 parameters with 0% schema coverage and an output schema exists (so return values don't need explanation), the description provides good coverage: purpose, parameters with examples, and return type. It could improve by addressing sibling differentiation and more behavioral context, but it's largely complete for a list tool.

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

Parameters5/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 fully documents all 3 parameters (category, difficulty, tag) with clear explanations and examples, adding substantial meaning beyond the bare schema. This effectively bridges the coverage gap.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'List available workflow templates' with the specific verb 'List' and resource 'workflow templates'. It distinguishes from some siblings like 'get_template' (singular) and 'search_templates' (search vs list), though not explicitly. However, it doesn't fully differentiate from 'list_official_templates' which seems similar.

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 provides implied usage through examples and parameter explanations, suggesting when to use filters like category or difficulty. However, it lacks explicit guidance on when to choose this tool over alternatives like 'search_templates' or 'list_official_templates', and doesn't mention prerequisites or exclusions.

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/christian-byrne/comfy-mcp'

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