Skip to main content
Glama

suggest_similar

Retrieve catalog names similar to a given name, using difflib and substring matching, up to a specified limit.

Instructions

Return up to limit catalog names close to name (difflib + substring).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'suggest_similar' — registered as a FastMCP server tool, delegates to _catalog.suggest_similar.
    @server.tool()
    def suggest_similar(name: str, limit: int = 5) -> list[str]:
        """Return up to ``limit`` catalog names close to ``name`` (difflib + substring)."""
        return _catalog.suggest_similar(name, limit=limit)
  • Tool registered with FastMCP via @server.tool() decorator in build_server()
    @server.tool()
    def suggest_similar(name: str, limit: int = 5) -> list[str]:
        """Return up to ``limit`` catalog names close to ``name`` (difflib + substring)."""
        return _catalog.suggest_similar(name, limit=limit)
  • Core implementation of suggest_similar — uses difflib.get_close_matches (cutoff=0.6) and substring fallback to find similar indicator names from the catalog.
    def suggest_similar(name: str, limit: int = 5) -> list[str]:
        """Return up to ``limit`` catalog names that are close matches to ``name``.
    
        Primary: ``difflib.get_close_matches`` with ``cutoff=0.6`` (handles typos).
        Fallback: substring containment — if the query contains a catalog name, or
        a catalog name contains the query, surface those too. Catches cases like
        ``"fake_rsi"`` → suggest ``"rsi"`` that difflib misses because the length
        mismatch drags the similarity ratio below the cutoff.
        """
        if not name:
            return []
        q = name.lower()
        keys = list(_CATALOG.keys())
        ranked = difflib.get_close_matches(q, keys, n=limit, cutoff=0.6)
        ranked_set = set(ranked)
        if len(ranked) < limit:
            for k in keys:
                if k in q or q in k:
                    if k not in ranked_set:
                        ranked.append(k)
                        ranked_set.add(k)
                        if len(ranked) >= limit:
                            break
        return ranked[:limit]
  • Function signature defines the schema: name (str), limit (int, default 5), returns list[str]
    def suggest_similar(name: str, limit: int = 5) -> list[str]:
Behavior3/5

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

The description reveals the algorithm (difflib + substring) but lacks behavioral details like case sensitivity, matching threshold, behavior when no matches found, or how the ordering works. With no annotations, it carries the full disclosure burden but only partially meets it.

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?

A single sentence that is front-loaded with the core purpose and method. No redundant words, and it efficiently communicates the tool's function.

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 presence of an output schema (known from context), the description does not need to detail return values. It covers the essential purpose and parameters for a simple suggestion tool, though it could mention edge cases or error handling for completeness.

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?

Despite 0% schema description coverage, the description explains both parameters: `name` as the search term and `limit` as the maximum number of results. It adds context by stating 'up to' for limit, which the schema does not convey, effectively compensating for the schema gap.

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 it returns similar catalog names based on string similarity, specifying the verb 'return', the resource 'catalog names', and the method 'difflib + substring'. It distinguishes itself from sibling tools like list_indicators or describe_component_api by its unique suggestion functionality.

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?

No guidance is provided on when to use this tool versus alternatives such as list_catalogs or search functions. There is no mention of prerequisites, when not to use it, or how it fits into a workflow.

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/DolphinQuant/echolon'

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