get_projects
Retrieve all projects with basic details like ID, name, timestamps, and archived status from Productive.io to access essential project data efficiently.
Instructions
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
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:188-198 (registration)MCP tool registration for 'get_projects'. Thin wrapper that delegates to tools.get_projects(ctx). Defines input schema (none) and output docstring.@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:27-48 (handler)Core handler logic: logs progress, calls client.get_projects with sort param, filters response using filter_response, handles ProductiveAPIError and general exceptions using shared error handler.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
- productive_client.py:77-79 (helper)Productive API client method that performs 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)