Skip to main content
Glama

recommend_for_project

Recommend top MCP servers for your project by analyzing its description and explaining why each fits.

Instructions

Given a project description, recommend the top MCP servers to install and explain why each one fits. Example: "Python FastAPI backend with PostgreSQL and JWT auth"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'recommend_for_project' tool handler function. It is a FastMCP tool registered with @mcp.tool(), accepts a project description string, ensures the index is built, calls find_similar() to get top 5 matching servers, formats results with rationales, and returns the recommendation.
    @mcp.tool()
    def recommend_for_project(description: str) -> str:
        """
        Given a project description, recommend the top MCP servers to install and explain why each one fits.
        Example: "Python FastAPI backend with PostgreSQL and JWT auth"
        """
        try:
            _ensure_index()
            results = find_similar(description, top_k=5)
            header = f"## Recommended MCP servers for: {description}\n\n"
            return header + _format_results(results, description)
        except Exception as e:
            return _error_response("generating recommendations", e)
  • The @mcp.tool() decorator registers 'recommend_for_project' as an MCP tool on the FastMCP server instance.
    @mcp.tool()
  • find_similar() - helper function called by recommend_for_project. Performs semantic search over the embedded server index using cosine similarity, with adaptive fallback threshold.
    def find_similar(
        query: str,
        top_k: int = 10,
        exclude: list[str] | None = None,
        min_score: float = DEFAULT_MIN_SCORE,
    ) -> list[dict]:
        """
        Return top_k servers most semantically similar to query.
        Each result: {name, url, description, category, score}
        """
        model = _get_model()
        query_emb = model.encode([query])[0].tolist()
    
        excluded_lower = {n.lower() for n in (exclude or [])}
        fetch_limit = top_k + max(len(excluded_lower) * 3, 10)
    
        con = get_connection()
        rows = con.execute(
            """
            SELECT name, description, url, category, score FROM (
                SELECT name, description, url, category,
                       array_cosine_similarity(embedding, ?::FLOAT[384]) AS score
                FROM servers
            )
            WHERE score >= ?
            ORDER BY score DESC
            LIMIT ?
            """,
            [query_emb, min_score, fetch_limit],
        ).fetchall()
        con.close()
    
        results = []
        for name, desc, url, cat, score in rows:
            name_lower = name.lower()
            short_name = name_lower.split("/")[-1]
            if any(
                e == name_lower or e == short_name or e in name_lower
                for e in excluded_lower
            ):
                continue
            results.append(
                {
                    "name": name,
                    "url": url,
                    "description": desc,
                    "category": cat,
                    "score": float(score),
                }
            )
            if len(results) >= top_k:
                break
    
        # Adaptive fallback: if nothing cleared the threshold, return the closest
        # matches below it so callers never silently get zero results.
        if not results and min_score > 0:
            return find_similar(query, top_k=top_k, exclude=exclude, min_score=0.0)
    
        return results
  • generate_rationale() - helper function used to produce the textual rationale explaining why each server was recommended. Called from _format_results() within recommend_for_project.
    def generate_rationale(server: dict, project_description: str) -> str:
        """
        Template-based rationale: why this server fits this project.
        No LLM call — grounded, fast, offline.
        """
        name = server["name"]
        desc = server["description"]
        category = server["category"]
        score = server.get("score", 0)
    
        # Extract key nouns from project description (simple word overlap)
        proj_words = set(re.findall(r"[a-z0-9]+", project_description.lower()))
        desc_words = set(re.findall(r"[a-z0-9]+", desc.lower()))
        overlap = (proj_words & desc_words) - STOPWORDS
    
        if overlap:
            match_hint = f"It shares focus on: {', '.join(sorted(overlap)[:5])}."
        else:
            match_hint = f"It falls under the '{category}' category, which aligns with your project's needs."
    
        confidence = "strong" if score > 0.55 else "moderate" if score > 0.40 else "potential"
    
        return (
            f"{name} — {desc} "
            f"[{confidence} match | category: {category}] "
            f"{match_hint}"
        )
  • _format_results() - helper that formats the list of result dicts into a markdown string, called directly by recommend_for_project.
    def _format_results(results: list[dict], project_description: str) -> str:
        if not results:
            return "No matching MCP servers found. Try a more descriptive project description."
    
        lines = []
        for i, r in enumerate(results, 1):
            rationale = generate_rationale(r, project_description)
            lines.append(
                f"{i}. **{r['name']}**\n"
                f"   {r['url']}\n"
                f"   {rationale}\n"
            )
        return "\n".join(lines)
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It fails to mention criteria for 'top' servers, any limitations, or authentication needs. The example adds some context but is insufficient for full transparency.

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 extremely concise: two sentences and an example. Every sentence adds value, no wasted words. The purpose is front-loaded.

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 the tool's simplicity (one required parameter, output schema exists), the description is largely complete. It explains the input and output behavior. However, it could be improved by mentioning the output format or criteria for recommendations.

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

Parameters4/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 explains the parameter 'description' as 'project description' and provides an example, adding meaningful context beyond the schema.

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 verb 'recommend' and the resource 'top MCP servers', and includes an example that illustrates the input and output. It distinguishes itself from siblings (recommend_next, explain_why) by specifying it provides explanations for each recommendation.

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 gives an example use case but does not explicitly state when to use this tool versus siblings or when not to use it. There are no exclusions or alternative recommendations.

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/yahiaklk/mcpilot'

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