get_project
Retrieve project details by ID from the Goodday platform for context-aware applications.
Instructions
Get details of a specific project.
Args: project_id: The ID of the project to retrieve
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes |
Implementation Reference
- goodday_mcp/main.py:321-336 (handler)The core handler function for the 'get_project' MCP tool. It takes a project_id, fetches the project data from the Goodday API using make_goodday_request, handles errors, and formats the output using format_project.async def get_project(project_id: str) -> str: """Get details of a specific project. Args: project_id: The ID of the project to retrieve """ data = await make_goodday_request(f"project/{project_id}") if not data: return "Project not found." if isinstance(data, dict) and "error" in data: return f"Unable to fetch project: {data.get('error', 'Unknown error')}" return format_project(data)
- goodday_mcp/main.py:115-134 (helper)Helper function called by get_project to format the raw project dictionary into a human-readable string with defensive checks for nested data.def format_project(project: dict) -> str: """Format a project into a readable string with safe checks.""" if not isinstance(project, dict): return f"Invalid project data: {repr(project)}" # Defensive defaults in case nested keys are not dicts status = project.get('status') if isinstance(project.get('status'), dict) else {} owner = project.get('owner') if isinstance(project.get('owner'), dict) else {} return f""" Project ID: {project.get('id', 'N/A')} Name: {project.get('name', 'N/A')} Health: {project.get('health', 'N/A')} Status: {status.get('name', 'N/A')} Start Date: {project.get('startDate', 'N/A')} End Date: {project.get('endDate', 'N/A')} Progress: {project.get('progress', 0)}% Owner: {owner.get('name', 'N/A')} """.strip()
- goodday_mcp/main.py:15-57 (helper)Core API request helper used by get_project to make authenticated HTTP requests to the Goodday API endpoint 'project/{project_id}'.async def make_goodday_request(endpoint: str, method: str = "GET", data: dict = None, subfolders: bool = True) -> dict[str, Any] | list[Any] | None: """Make a request to the Goodday API with proper error handling.""" api_token = os.getenv("GOODDAY_API_TOKEN") if not api_token: raise ValueError("GOODDAY_API_TOKEN environment variable is required") headers = { "User-Agent": USER_AGENT, "gd-api-token": api_token, "Content-Type": "application/json" } # Automatically add subfolders=true for project task and document endpoints if not already present if subfolders and endpoint.startswith("project/") and ("/tasks" in endpoint or "/documents" in endpoint): if "?" in endpoint: if "subfolders=" not in endpoint: endpoint += "&subfolders=true" else: endpoint += "?subfolders=true" url = f"{GOODDAY_API_BASE}/{endpoint.lstrip('/')}" async with httpx.AsyncClient() as client: try: if method.upper() == "POST": response = await client.post(url, headers=headers, json=data, timeout=30.0) elif method.upper() == "PUT": response = await client.put(url, headers=headers, json=data, timeout=30.0) elif method.upper() == "DELETE": response = await client.delete(url, headers=headers, timeout=30.0) else: response = await client.get(url, headers=headers, timeout=30.0) response.raise_for_status() return response.json() except httpx.HTTPStatusError as e: raise Exception(f"HTTP error {e.response.status_code}: {e.response.text}") except httpx.RequestError as e: raise Exception(f"Request error: {str(e)}") except Exception as e: raise Exception(f"Unexpected error: {str(e)}")
- goodday_mcp/main.py:321-321 (registration)The @mcp.tool() decorator registers the get_project function as an MCP tool.async def get_project(project_id: str) -> str: