search_nodes
Find ComfyUI workflow nodes by searching names, categories, or descriptions to quickly locate specific functionality for automation tasks.
Instructions
Search for nodes by name, category, or description.
Args:
query: Search string (searches name, category, description)
Returns matching nodes sorted by relevance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query |
Implementation Reference
- The core handler implementation for the 'search_nodes' tool. It searches through cached ComfyUI nodes, scoring matches in name (10pts), category (5pts), and description (3pts), sorts by score descending, and returns up to 50 top matches.@mcp.tool() def search_nodes( query: str = Field(description="Search query"), ctx: Context = None, ) -> list: """Search for nodes by name, category, or description. Args: query: Search string (searches name, category, description) Returns matching nodes sorted by relevance. """ if ctx: ctx.info(f"Searching for: {query}") try: nodes = get_cached_nodes() query_lower = query.lower() results = [] for name, info in nodes.items(): score = 0 # Name match (highest priority) if query_lower in name.lower(): score += 10 # Category match if query_lower in info.get("category", "").lower(): score += 5 # Description match if query_lower in info.get("description", "").lower(): score += 3 if score > 0: results.append((name, score)) # Sort by score descending results.sort(key=lambda x: x[1], reverse=True) return [name for name, _ in results[:50]] # Limit to 50 results except Exception as e:
- src/comfy_mcp_server/tools/__init__.py:26-26 (registration)Within register_all_tools, calls register_discovery_tools(mcp), which defines and registers the search_nodes tool via @mcp.tool() decorator.register_discovery_tools(mcp)
- src/comfy_mcp_server/__init__.py:92-92 (registration)Top-level registration call to register_all_tools(mcp), which transitively registers the search_nodes tool.register_all_tools(mcp)