"""get_critical_path MCP tool implementation.""" from xer_mcp.db.queries import query_critical_path from xer_mcp.server import is_file_loaded async def get_critical_path() -> dict: """Get all activities on the critical path. Returns activities where driving_path_flag is set, ordered by target start date. The critical path determines the minimum project duration. Returns: Dictionary with list of critical path activities, each containing: - task_id: Activity ID - task_code: Activity code - task_name: Activity name - task_type: Activity type (TT_Task, TT_Mile, etc.) - target_start_date: Target start date - target_end_date: Target end date - total_float_hr_cnt: Total float in hours - status_code: Activity status """ if not is_file_loaded(): return { "error": { "code": "NO_FILE_LOADED", "message": "No XER file is loaded. Use the load_xer tool first.", } } critical_activities = query_critical_path() return { "critical_activities": critical_activities, }