get_projects
Retrieve all active projects with budgets, deadlines, team assignments, and client details to track project progress and resource allocation.
Instructions
Get all active projects with budgets, deadlines, and team assignments.
Returns comprehensive project data including:
Project budgets, hourly rates, and cost tracking
Team members with roles and hourly rates
Deadlines, start/end dates, and project status
Client information and contact details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tools.py:27-49 (handler)Main handler function that fetches projects from the Productive API client, applies sorting and filtering, handles errors, and returns the processed ToolResult.async def get_projects(ctx: Context) -> ToolResult: """Fetch projects and post-process response for LLM safety. Developer notes: - Wraps client.get_projects(); sorts by most recent activity first. - Applies utils.filter_response to strip noise and add webapp_url. - Raises ProductiveAPIError on API failure; errors are logged via ctx. """ try: await ctx.info("Fetching all projects") params = {"sort": "-last_activity_at"} result = await client.get_projects(params=params) await ctx.info("Successfully retrieved projects") filtered = filter_response(result) return filtered except ProductiveAPIError as e: await _handle_productive_api_error(ctx, e, "projects") except Exception as e: await ctx.error(f"Unexpected error fetching projects: {str(e)}") raise e
- server.py:175-186 (registration)MCP tool registration decorator (@mcp.tool) that defines the tool entrypoint, docstring for LLM, and delegates to the handler in tools.py.@mcp.tool async def get_projects(ctx: Context) -> Dict[str, Any]: """Get all projects with basic information. Returns project data including: - Project ID, name, and number - Creation and last activity timestamps - Archived status (if applicable) - Webapp URL for direct access """ return await tools.get_projects(ctx)
- tools.py:9-24 (helper)Helper function to consistently handle ProductiveAPIError across tools, logging via ctx and raising the exception.async def _handle_productive_api_error(ctx: Context, e: ProductiveAPIError, resource_type: str = "data") -> None: """Handle ProductiveAPIError consistently across all tool functions. Developer notes: - ctx: MCP context for logging and error handling - e: The ProductiveAPIError exception - resource_type: Type of resource being fetched (e.g., "projects", "tasks", "comments") """ await ctx.error(f"Productive API error: {e.message}") if e.status_code == 404: await ctx.warning(f"No {resource_type} found") elif e.status_code == 401: await ctx.error("Invalid API token - check configuration") raise e
- productive_client.py:77-80 (helper)Productive API client method that makes the HTTP GET request to /projects endpoint with optional params.async def get_projects(self, params: Optional[dict] = None) -> Dict[str, Any]: """Get all projects""" return await self._request("GET", "/projects", params=params)