suggest_file_patterns
Suggest file patterns for a project to generate Doxygen documentation, with options for language, tests, and examples.
Instructions
Suggest appropriate file patterns for a project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | ||
| primary_language | No | ||
| include_tests | No | ||
| include_examples | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/doxygen_mcp/server.py:419-498 (handler)The actual handler function for the 'suggest_file_patterns' tool. It is decorated with @mcp.tool(), accepts project_path, primary_language, include_tests, and include_examples parameters, analyzes actual files in the project directory, and returns suggested file patterns for Doxygen configuration.
@mcp.tool() async def suggest_file_patterns( project_path: str, primary_language: str = "", include_tests: bool = False, include_examples: bool = True, ) -> str: """Suggest appropriate file patterns for a project""" project_path = Path(project_path) if not project_path.exists(): return f"ā Project path does not exist: {project_path}" try: # Analyze actual files in the project extensions = {} for file_path in project_path.rglob("*"): if file_path.is_file(): ext = file_path.suffix.lower() if ext: extensions[ext] = extensions.get(ext, 0) + 1 # Language-specific pattern suggestions language_patterns = { "c": ["*.c", "*.h"], "cpp": ["*.cpp", "*.cxx", "*.cc", "*.C", "*.hpp", "*.hxx", "*.hh", "*.H"], "python": ["*.py", "*.pyx", "*.pyi"], "java": ["*.java"], "php": ["*.php", "*.php3", "*.inc"], "javascript": ["*.js", "*.jsx", "*.ts", "*.tsx"], "csharp": ["*.cs"], "go": ["*.go"], "rust": ["*.rs"] } # Build suggestions based on found files and language suggested_patterns = [] if primary_language.lower() in language_patterns: suggested_patterns.extend(language_patterns[primary_language.lower()]) # Add patterns based on actual files found common_source_extensions = { ".c", ".cpp", ".cxx", ".cc", ".h", ".hpp", ".hxx", ".hh", ".py", ".java", ".php", ".js", ".jsx", ".ts", ".tsx", ".cs", ".go", ".rs", ".rb", ".pl", ".sh" } for ext in extensions: if ext in common_source_extensions: pattern = f"*{ext}" if pattern not in suggested_patterns: suggested_patterns.append(pattern) # Optional patterns optional_patterns = [] if include_examples and any(ext in [".md", ".txt", ".rst"] for ext in extensions): optional_patterns.extend(["*.md", "*.txt", ".rst"]) if include_tests: optional_patterns.extend(["test_*.py", "*_test.cpp", "Test*.java"]) result_text = f"""š File Pattern Suggestions for: {project_path} šÆ Recommended Patterns: {chr(10).join(f" š {pattern}" for pattern in suggested_patterns)} š Found Extensions: {chr(10).join(f" {ext}: {count} files" for ext, count in sorted(extensions.items(), key=lambda x: x[1], reverse=True)[:10])} """ if optional_patterns: result_text += f"\nš§ Optional Patterns:\n{chr(10).join(f' š {pattern}' for pattern in optional_patterns)}" result_text += f"\n\nš” Add these patterns to your Doxyfile:\nFILE_PATTERNS = {' '.join(suggested_patterns)}" return result_text except Exception as e: return f"ā Error analyzing patterns: {str(e)}" - src/doxygen_mcp/server.py:419-419 (registration)The @mcp.tool() decorator registers 'suggest_file_patterns' as an MCP tool on the FastMCP server instance named 'Doxygen'.
@mcp.tool()