Skip to main content
Glama
gemini2026

Documentation Search MCP Server

by gemini2026

suggest_secure_libraries

Find secure programming libraries by searching partial names and viewing security scores to make informed development decisions.

Instructions

Enhanced library suggestions that include security scores for informed decisions.

Args:
    partial_name: Partial library name to search for
    include_security_score: Whether to include security scores (slower but more informative)

Returns:
    Library suggestions with optional security information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
partial_nameYes
include_security_scoreNo

Implementation Reference

  • The primary handler function for the 'suggest_secure_libraries' MCP tool. It fetches basic library suggestions and enriches the top 5 with security scores obtained from security_integration.get_security_summary, sorts by score, and returns enhanced suggestions.
    @mcp.tool()
    async def suggest_secure_libraries(
        partial_name: str, include_security_score: bool = True
    ):
        """
        Enhanced library suggestions that include security scores for informed decisions.
    
        Args:
            partial_name: Partial library name to search for
            include_security_score: Whether to include security scores (slower but more informative)
    
        Returns:
            Library suggestions with optional security information
        """
        await enforce_rate_limit("suggest_secure_libraries")
    
        # Get basic suggestions first
        basic_suggestions = await suggest_libraries(partial_name)
    
        if not include_security_score or not basic_suggestions:
            return {
                "suggestions": basic_suggestions,
                "partial_name": partial_name,
                "security_info_included": False,
            }
    
        # Add security information for top 5 suggestions
        from .vulnerability_scanner import security_integration
    
        enhanced_suggestions = []
        top_suggestions = basic_suggestions[:5]  # Limit to avoid too many API calls
    
        # Get security scores in parallel
        security_tasks = [
            security_integration.get_security_summary(lib, "PyPI")
            for lib in top_suggestions
        ]
    
        try:
            security_results = await asyncio.gather(*security_tasks, return_exceptions=True)
    
            for lib, sec_res_item in zip(top_suggestions, security_results):
                suggestion = {"library": lib}
    
                if isinstance(sec_res_item, Exception):
                    suggestion.update(
                        {
                            "security_score": None,
                            "security_status": "unknown",
                            "security_badge": "❓",
                        }
                    )
                else:
                    security_result = sec_res_item
                    score = security_result.get("security_score", 50)
                    suggestion.update(
                        {
                            "security_score": score,
                            "security_status": security_result.get("status", "unknown"),  # type: ignore
                            "security_badge": (
                                "🛡️"
                                if score >= 90
                                else "✅"
                                if score >= 70
                                else "⚠️"
                                if score >= 50
                                else "🚨"
                            ),
                            "vulnerabilities": security_result.get(
                                "total_vulnerabilities", 0
                            ),  # type: ignore
                        }
                    )
    
                enhanced_suggestions.append(suggestion)
    
            # Add remaining suggestions without security info
            for lib in basic_suggestions[5:]:
                enhanced_suggestions.append(
                    {
                        "library": lib,
                        "security_score": None,
                        "security_status": "not_scanned",
                        "note": "Use scan_library_vulnerabilities for security details",
                    }
                )
    
            # Sort by security score for enhanced suggestions
            enhanced_suggestions.sort(
                key=lambda x: x.get("security_score") or 0, reverse=True
            )
    
            return {
                "suggestions": enhanced_suggestions,
                "partial_name": partial_name,
                "security_info_included": True,
                "total_suggestions": len(enhanced_suggestions),
                "note": "Libraries with security scores are sorted by security rating",
            }
    
        except Exception as e:
            return {
                "suggestions": [{"library": lib} for lib in basic_suggestions],
                "partial_name": partial_name,
                "security_info_included": False,
                "error": f"Security enhancement failed: {str(e)}",
            }
  • The 'suggest_libraries' helper tool called by suggest_secure_libraries to get initial library name matches from the configured docs_urls dictionary.
    @mcp.tool()
    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
  • The SecurityIntegration.get_security_summary method used by suggest_secure_libraries to obtain security scores and summaries for suggested libraries by scanning OSV, GitHub advisories, and Safety DB.
    async def get_security_summary(
        self, library_name: str, ecosystem: str = "PyPI"
    ) -> Dict[str, Any]:
        """Get concise security summary"""
        try:
            report = await self.scanner.scan_library(library_name, ecosystem)
            return {
                "library": library_name,
                "security_score": report.security_score,
                "total_vulnerabilities": report.total_vulnerabilities,
                "critical_vulnerabilities": report.critical_count,
                "status": "secure" if report.security_score >= 70 else "at_risk",
                "primary_recommendation": (
                    report.recommendations[0]
                    if report.recommendations
                    else "No specific recommendations"
                ),
            }
        except Exception as e:
            return {
                "library": library_name,
                "security_score": 50.0,
                "error": str(e),
                "status": "unknown",
            }
  • Core VulnerabilityScanner.scan_library method that performs parallel scans across OSV, GitHub advisories, and Safety DB (for PyPI), generates SecurityReport, and caches results. Called by get_security_summary.
    async def scan_library(
        self, library_name: str, ecosystem: str = "PyPI"
    ) -> SecurityReport:
        """
        Comprehensive vulnerability scan for a library
    
        Args:
            library_name: Name of the library (e.g., "fastapi", "react")
            ecosystem: Package ecosystem ("PyPI", "npm", "Maven", etc.)
    
        Returns:
            SecurityReport with vulnerability details
        """
        cache_key = f"{library_name}_{ecosystem}"
    
        # Check cache first
        if self._is_cached(cache_key):
            return self.cache[cache_key]["data"]
    
        vulnerabilities = []
    
        # Scan multiple sources in parallel
        scan_tasks = [
            self._scan_osv(library_name, ecosystem),
            self._scan_github_advisories(library_name, ecosystem),
            (
                self._scan_safety_db(library_name)
                if ecosystem.lower() == "pypi"
                else self._empty_scan()
            ),
        ]
    
        try:
            results = await asyncio.gather(*scan_tasks, return_exceptions=True)
    
            for result in results:
                if isinstance(result, list):
                    vulnerabilities.extend(result)
                elif isinstance(result, Exception):
                    print(f"Scan error: {result}", file=sys.stderr)
    
        except Exception as e:
            print(f"Vulnerability scan failed for {library_name}: {e}", file=sys.stderr)
    
        # Generate security report
        report = self._generate_security_report(
            library_name, ecosystem, vulnerabilities
        )
    
        # Cache the result
        self._cache_result(cache_key, report)
    
        return report
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that including security scores is 'slower but more informative,' which hints at performance trade-offs, but lacks details on permissions, rate limits, error handling, or what 'enhanced' entails beyond security scores. This is insufficient for a tool with potential performance implications.

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 well-structured and appropriately sized, with a clear purpose statement followed by parameter and return explanations. Every sentence adds value, though it could be slightly more front-loaded by emphasizing the security aspect earlier.

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 (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the purpose and parameters but lacks details on output format, error cases, and integration with sibling tools, leaving gaps for an AI agent to fully understand its use.

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?

The description adds meaning beyond the input schema by explaining that 'partial_name' is for searching and 'include_security_score' affects speed and informativeness. However, with 0% schema description coverage, it doesn't fully compensate for the lack of schema details, such as format constraints or examples for 'partial_name.' The baseline is 3 due to some added value.

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: 'Enhanced library suggestions that include security scores for informed decisions.' This specifies the verb (suggest), resource (libraries), and key feature (security scores). However, it doesn't explicitly differentiate from its sibling 'suggest_libraries' beyond mentioning 'enhanced' and security scores, which is why it doesn't reach 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 the sibling 'suggest_libraries' or other related tools like 'compare_library_security' or 'scan_library_vulnerabilities', nor does it specify contexts or exclusions for its use.

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/gemini2026/documentation-search-mcp'

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