get_task
Retrieve comprehensive task details including status, assigned team members, project context, time tracking, comments, files, and deadlines by providing the task ID.
Instructions
Get detailed task information by ID including all related data.
Returns comprehensive task details including:
Task description, priority, and current status
Assigned team member with role and hourly rate
Parent project with budget and client details
Time tracking: estimated vs actual hours
All comments and discussion history
Attached files and checklist items (todos)
Due dates, start dates, and completion timeline
Args: task_id: Productive task ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | Productive task ID |
Implementation Reference
- tools.py:98-119 (handler)Core handler function that executes the tool logic: fetches task details from Productive API client, filters the response, and handles errors appropriately.async def get_task(ctx: Context, task_id: int) -> ToolResult: """Fetch a single task by internal ID. Developer notes: - Wraps client.get_task(task_id). - Applies utils.filter_response to sanitize output. - Raises ProductiveAPIError on failure. """ try: await ctx.info(f"Fetching task with ID: {task_id}") result = await client.get_task(task_id) await ctx.info("Successfully retrieved task") filtered = filter_response(result) return filtered except ProductiveAPIError as e: await _handle_productive_api_error(ctx, e, f"task {task_id}") except Exception as e: await ctx.error(f"Unexpected error fetching task: {str(e)}") raise e
- server.py:231-250 (registration)MCP tool registration using @mcp.tool decorator, including input schema via Annotated Field and docstring description. Delegates to the core handler in tools.py.@mcp.tool async def get_task( ctx: Context, task_id: Annotated[ int, Field(description="The unique Productive task identifier (internal ID)") ], ) -> Dict[str, Any]: """Get detailed task information by its internal ID. Use this when you have the internal task ID (e.g., 14677418). For looking up tasks by their project-specific number (e.g., #960), use get_project_task instead. Returns task details including: - Task title, description, and status (open/closed) - Due date, start date, and creation/update timestamps - Time tracking: initial estimate, remaining time, billable time, and worked time (in minutes) - Todo counts: total and open """ return await tools.get_task(ctx=ctx, task_id=task_id)
- productive_client.py:86-89 (helper)Low-level API client method that performs the HTTP GET request to retrieve a single task by ID from the Productive API.async def get_task(self, task_id: int) -> Dict[str, Any]: """Get task by ID""" return await self._request("GET", f"/tasks/{str(task_id)}")
- tools.py:9-24 (helper)Helper function used by the handler to consistently handle and log ProductiveAPIError exceptions.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