get_project_tasks
Retrieve tasks from a specific Goodday project, including options for closed tasks and subfolder tasks, to manage project workflows effectively.
Instructions
Get tasks from a specific project.
Args: project_id: The ID of the project closed: Set to true to retrieve all open and closed tasks subfolders: Set to true to return tasks from project subfolders
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| closed | No | ||
| subfolders | No |
Implementation Reference
- goodday_mcp/main.py:393-424 (handler)The core handler function for the MCP tool 'get_project_tasks'. It constructs the Goodday API endpoint based on project_id and optional parameters (closed, subfolders), fetches the task data using make_goodday_request, handles errors and unexpected formats, formats each task using format_task, and returns a markdown-formatted list of tasks separated by ---.async def get_project_tasks(project_id: str, closed: bool = False, subfolders: bool = False) -> str: """Get tasks from a specific project. Args: project_id: The ID of the project closed: Set to true to retrieve all open and closed tasks subfolders: Set to true to return tasks from project subfolders """ params = [] if closed: params.append("closed=true") if subfolders: params.append("subfolders=true") endpoint = f"project/{project_id}/tasks" if params: endpoint += "?" + "&".join(params) data = await make_goodday_request(endpoint) if not data: return "No tasks found." if isinstance(data, dict) and "error" in data: return f"Unable to fetch tasks: {data.get('error', 'Unknown error')}" if not isinstance(data, list): return f"Unexpected response format: {str(data)}" tasks = [format_task(task) for task in data] return "\n---\n".join(tasks)
- goodday_mcp/main.py:94-113 (helper)Helper function used by get_project_tasks to format individual task dictionaries into a readable markdown string, safely handling nested structures like status and project.def format_task(task: dict) -> str: """Format a task into a readable string with safe checks.""" if not isinstance(task, dict): return f"Invalid task data: {repr(task)}" # Defensive defaults in case nested keys are not dicts status = task.get('status') if isinstance(task.get('status'), dict) else {} project = task.get('project') if isinstance(task.get('project'), dict) else {} return f""" **Task ID:** {task.get('shortId', 'N/A')} **Title:** {task.get('name', 'N/A')} **Status:** {status.get('name', 'N/A')} **Project:** {project.get('name', 'N/A')} **Assigned To:** {task.get('assignedToUserId', 'N/A')} **Priority:** {task.get('priority', 'N/A')} **Start Date:** {task.get('startDate', 'N/A')} **End Date:** {task.get('endDate', 'N/A')} **Description:** {task.get('message', 'No description')} """.strip()