Skip to main content
Glama

search_templates

Find workflow templates by searching across names, descriptions, and tags using fuzzy matching to locate relevant ComfyUI workflow templates.

Instructions

Search templates by name, description, or tags.

Performs fuzzy search across template metadata to find relevant workflow templates.

Args: query: Search query (searches name, description, tags)

Returns: List of matching templates

Examples: search_templates("pose") search_templates("upscaling") search_templates("text to image")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • MCP tool handler for search_templates. Delegates to TemplateManager.search_templates(query) and handles errors.
    @mcp.tool def search_templates(query: str) -> list[dict]: """Search templates by name, description, or tags. Performs fuzzy search across template metadata to find relevant workflow templates. Args: query: Search query (searches name, description, tags) Returns: List of matching templates Examples: search_templates("pose") search_templates("upscaling") search_templates("text to image") """ try: results = template_manager.search_templates(query=query) return results except Exception as e: raise ToolError(f"Error searching templates: {e}")
  • Core implementation of template search in TemplateManager. Filters templates by query (fuzzy search on name/desc/tags), category, tags, difficulty, source. Called by the MCP handler.
    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
  • Search implementation specific to official templates, used indirectly via TemplateManager.
    def search_templates( self, query: Optional[str] = None, category: Optional[str] = None ) -> List[Dict[str, Any]]: """Search official templates.""" results = self.list_templates() if query: query_lower = query.lower() results = [ t for t in results if query_lower in t["name"].lower() or query_lower in t["description"].lower() or query_lower in t["category"].lower() ] if category: results = [ t for t in results if t["category"].lower() == category.lower() ] return results

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