Skip to main content
Glama

analyze_project_tasks

Evaluate and analyze tasks within a project to provide insights and task breakdowns. Optionally export results as a CSV file for further review or reporting.

Instructions

Phân tích các tasks trong dự án Args: project_id: ID của dự án export_csv: Có xuất file CSV không (default: False) Returns: Phân tích tasks dưới dạng dictionary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
export_csvNo
project_idYes

Implementation Reference

  • The primary handler for the 'analyze_project_tasks' MCP tool. Decorated with @mcp.tool(), it fetches project information and task analysis data from WeWorkClient, processes the DataFrame to compute task statistics by status, converts tasks to a list of dictionaries, optionally exports results to CSV, and returns a comprehensive dictionary with summary statistics.
    @mcp.tool() def analyze_project_tasks(project_id: str, export_csv: bool = False) -> Dict[str, Any]: """ Phân tích các tasks trong dự án Args: project_id: ID của dự án export_csv: Có xuất file CSV không (default: False) Returns: Phân tích tasks dưới dạng dictionary """ try: if not wework_client: return {'error': 'WeWork client not initialized'} logger.info(f"Analyzing tasks for project ID: {project_id}") # Lấy thông tin dự án project_info = wework_client.get_project_info(project_id) if not project_info: return { 'error': f'Không tìm thấy dự án với ID: {project_id}', 'success': False } # Phân tích tasks df = wework_client.get_project_analysis(project_id) if df.empty: return { 'success': True, 'project_name': project_info['name'], 'project_id': project_id, 'tasks': [], 'summary': { 'total_tasks': 0, 'completed_tasks': 0, 'in_progress_tasks': 0, 'failed_tasks': 0 } } # Tính thống kê status_counts = df['Trạng thái'].value_counts().to_dict() if 'Trạng thái' in df.columns else {} # Chuyển DataFrame thành dictionary tasks_data = df.to_dict(orient='records') # Xuất CSV nếu được yêu cầu csv_filename = None if export_csv: csv_filename = f"{project_info['name']}_tasks_analysis.csv" try: df.to_csv(csv_filename, index=False, encoding='utf-8-sig') logger.info(f"CSV exported to: {csv_filename}") except Exception as csv_error: logger.error(f"Failed to export CSV: {csv_error}") result = { 'success': True, 'project_name': project_info['name'], 'project_id': project_id, 'tasks': tasks_data, 'total_tasks': len(df), 'summary': { 'total_tasks': len(df), 'completed_tasks': status_counts.get('Hoàn thành', 0), 'in_progress_tasks': status_counts.get('Đang thực hiện', 0), 'failed_tasks': status_counts.get('Thất bại', 0), 'status_breakdown': status_counts } } if csv_filename: result['csv_file'] = csv_filename return result except Exception as e: logger.error(f"Error in analyze_project_tasks: {e}") return {'error': str(e), 'success': False}
  • Imports the analyze_project_tasks function (along with other tools) from wework_mcp_server.py for use in the HTTP server endpoints.
    from wework_mcp_server import ( search_projects, get_project_details, analyze_project_tasks, find_project_by_name, get_project_statistics, test_connection )
  • HTTP endpoint handler in wework_http_server.py that calls analyze_project_tasks for POST /api/project/analyze requests.
    """Analyze project tasks endpoint""" try: result = analyze_project_tasks(project_id, export_csv) self.send_json_response(result) except Exception as e: self.send_error_response(f"Analysis failed: {str(e)}")

Other Tools

Related 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/FOX2920/Aplus-MCP'

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