get_comment
Retrieve complete comment details including text, author information, parent context, reply threads, and attached files from Productive.io using the comment ID.
Instructions
Get specific comment details with full context and discussion thread.
Returns detailed comment information including:
Complete comment text and formatting
Author details and timestamp
Parent entity (project, task, etc.) with full context
Reply thread and conversation flow
Attached files, images, or documents
Mentions and references to team members
Args: comment_id: Productive comment ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comment_id | Yes | Productive comment ID |
Implementation Reference
- tools.py:260-275 (handler)The core handler function for the 'get_comment' tool. It fetches a specific comment by ID using the Productive client, applies response filtering for LLM safety, logs progress, and handles API errors consistently.async def get_comment(ctx: Context, comment_id: int) -> ToolResult: """Fetch a single comment by ID and sanitize the response.""" try: await ctx.info(f"Fetching comment with ID: {comment_id}") result = await client.get_comment(comment_id) await ctx.info("Successfully retrieved comment") filtered = filter_response(result) return filtered except ProductiveAPIError as e: await _handle_productive_api_error(ctx, e, f"comment {comment_id}") except Exception as e: await ctx.error(f"Unexpected error fetching comment: {str(e)}") raise e
- server.py:356-373 (registration)The registration of the 'get_comment' tool using @mcp.tool decorator, including input schema via Annotated Field and docstring. Currently commented out.# @mcp.tool # async def get_comment( # ctx: Context, # comment_id: Annotated[int, Field(description="Productive comment ID")], # ) -> Dict[str, Any]: # """Get specific comment details with full context and discussion thread. # Returns detailed comment information including: # - Complete comment text and formatting # - Author details and timestamp # - Parent entity (project, task, etc.) with full context # - Reply thread and conversation flow # - Attached files, images, or documents # - Mentions and references to team members # """ # return await tools.get_comment(ctx, comment_id)
- productive_client.py:95-97 (helper)The Productive API client method that performs the actual HTTP GET request to retrieve a single comment by ID. Used by the tool handler.async def get_comment(self, comment_id: int) -> Dict[str, Any]: """Get comment by ID""" return await self._request("GET", f"/comments/{str(comment_id)}")
- tools.py:9-24 (helper)Shared error handling utility used by the get_comment handler and other tools to manage ProductiveAPIError with consistent logging and warnings.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