Skip to main content
Glama
compliance_tools_refactored.pyโ€ข2.26 kB
""" Compliance Tools - Refactored version with project root enforcement This demonstrates the proper way to refactor tools for project root discipline. """ from pathlib import Path from typing import Any, Dict from server.utils.base_tool import BaseMCPTool from utils.security import SecurityManager class ComplianceToolsRefactored(BaseMCPTool): """Compliance validation tools with project root enforcement.""" def __init__(self, security_manager: SecurityManager): """Initialize compliance tools with proper project root enforcement.""" super().__init__(security_manager) async def validate_compliance(self, arguments: Dict[str, Any]) -> Dict[str, Any]: """ Validate project compliance with security and regulatory standards. Args: arguments: Must contain project_root or use environment variables Returns: Compliance validation results Raises: ProjectRootError: If no valid project root can be resolved """ # This will raise ProjectRootError if no project root provided - let it bubble up normalized = self.normalize_inputs(arguments) project_root_str = self.resolve_project_root(normalized) try: # Extract parameters compliance_type = normalized.get("compliance_type", "gdpr") # Ensure we're not working in server CWD from server.utils.no_cwd_guard import assert_not_server_cwd assert_not_server_cwd(project_root_str) # Perform compliance validation results = { "project_root": project_root_str, "compliance_type": compliance_type, "validation_successful": True, "findings": [], } # Log audit event self.security_manager.log_audit_event( "validate_compliance", f"compliance_type:{compliance_type}", f"project_root:{project_root_str}", ) return {"success": True, "compliance_results": results} except (OSError, ValueError, RuntimeError) as e: return {"success": False, "error": f"Compliance validation failed: {str(e)}"}

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/normaltusker/kotlin-mcp-server'

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