Skip to main content
Glama

search_nodes

Find ComfyUI workflow nodes by name, category, or description to quickly locate the components needed 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
NameRequiredDescriptionDefault
queryYesSearch query

Implementation Reference

  • The main handler function for the 'search_nodes' tool. It implements fuzzy search across node names (priority 10), categories (5), and descriptions (3), sorts by relevance score, and limits to top 50 results.
    @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:
            return [f"Error: {e}"]
  • Pydantic schema definition for the search_nodes tool inputs: required 'query' string and optional Context.
    def search_nodes(
        query: str = Field(description="Search query"),
        ctx: Context = None,
    ) -> list:
  • Call within register_all_tools() to register the discovery tools module, which includes the search_nodes tool via its @mcp.tool() decorator.
    register_discovery_tools(mcp)
  • Top-level registration of all tools during server initialization, chaining to discovery tools including search_nodes.
    register_all_tools(mcp)
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 that results are 'sorted by relevance', which adds some behavioral context. However, it lacks details on permissions, rate limits, pagination, or error handling, which are important for a search operation with no annotation coverage.

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?

The description is concise and well-structured: it starts with the core purpose, includes an 'Args' section for parameters, and ends with return behavior. However, the formatting with indentation and line breaks could be slightly cleaner for optimal readability.

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

Completeness3/5

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

Given the tool's moderate complexity (search operation with one parameter), no annotations, and no output schema, the description is minimally adequate. It covers the purpose and parameter semantics but lacks details on output format, error cases, or integration with sibling tools, leaving gaps in completeness.

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 100%, so the schema already documents the 'query' parameter. The description adds that the query searches 'name, category, description', which provides additional semantic context beyond the schema's generic 'Search query'. This justifies a baseline score of 3, as the description adds some value but the schema does most of the work.

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: 'Search for nodes by name, category, or description.' It specifies the verb (search) and resource (nodes), and mentions the searchable fields. However, it doesn't explicitly differentiate from sibling tools like 'list_nodes' or 'get_node_info', which would require a 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'list_nodes' (which might list all nodes without search) or 'get_node_info' (which might retrieve details for a specific node), leaving the agent to infer usage context.

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/IO-AtelierTech/comfyui-mcp'

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