suggest_libraries
Find programming libraries by entering partial names to get auto-completion suggestions for documentation search.
Instructions
Suggest libraries based on partial input for auto-completion.
Args:
partial_name: Partial library name to search for (e.g. "lang" -> ["langchain"])
Returns:
List of matching library names
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| partial_name | Yes |
Implementation Reference
- The handler function for the 'suggest_libraries' MCP tool. It provides auto-completion suggestions for library names by matching against the configured docs_urls dictionary, prioritizing exact matches, then prefix matches, then substring matches, returning up to 10 sorted suggestions.async def suggest_libraries(partial_name: str): """ Suggest libraries based on partial input for auto-completion. Args: partial_name: Partial library name to search for (e.g. "lang" -> ["langchain"]) Returns: List of matching library names """ if not partial_name: return list(sorted(docs_urls.keys())) partial_lower = partial_name.lower() suggestions = [] # Exact matches first for lib in docs_urls.keys(): if lib.lower() == partial_lower: suggestions.append(lib) # Starts with matches for lib in docs_urls.keys(): if lib.lower().startswith(partial_lower) and lib not in suggestions: suggestions.append(lib) # Contains matches for lib in docs_urls.keys(): if partial_lower in lib.lower() and lib not in suggestions: suggestions.append(lib) return sorted(suggestions[:10]) # Limit to top 10 suggestions
- src/documentation_search_enhanced/main.py:692-692 (registration)The @mcp.tool() decorator registers the suggest_libraries function as an MCP tool.async def suggest_libraries(partial_name: str):