get_comment
Retrieve detailed information about a specific Product Hunt comment using its unique ID. Access comment content, user details, timestamps, and related post data.
Instructions
Retrieve detailed information about a specific comment by ID.
Parameters:
- id (str, required): The comment's unique ID.
Returns:
- success (bool)
- data (dict): If successful, contains comment details:
- id, content, created_at, user, post, etc.
- error (dict, optional)
- rate_limits (dict)
Notes:
- Returns an error if the comment is not found.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No |
Implementation Reference
- The get_comment tool handler: retrieves a specific comment by ID via GraphQL query, validates input, handles errors, logs the call, and formats the response with rate limits.def get_comment(id: str = None) -> Dict[str, Any]: """ Retrieve detailed information about a specific comment by ID. Parameters: - id (str, required): The comment's unique ID. Returns: - success (bool) - data (dict): If successful, contains comment details: - id, content, created_at, user, post, etc. - error (dict, optional) - rate_limits (dict) Notes: - Returns an error if the comment is not found. """ params = {k: v for k, v in {"id": id}.items() if v is not None} logger.info("comments.get_comment called", extra=params) comment_data, rate_limits, error = execute_and_check_query( COMMENT_QUERY, {"id": id}, "comment", id ) if error: return format_response(False, error=error, rate_limits=rate_limits) return format_response(True, data=comment_data, rate_limits=rate_limits)
- Schema for validating the input parameter 'id' (required string) for the get_comment tool.COMMENT_SCHEMA = {"id": {"required": True, "type": str}}
- src/product_hunt_mcp/cli.py:36-36 (registration)Registration of comment tools (including get_comment) by calling register_comment_tools on the MCP server instance in the main CLI entry point.register_comment_tools(mcp)
- src/product_hunt_mcp/tools/comments.py:27-58 (registration)Direct registration of the get_comment tool using @mcp.tool() decorator inside the register_comment_tools function.@mcp.tool() @require_token @handle_errors @validate_with_schema(COMMENT_SCHEMA) def get_comment(id: str = None) -> Dict[str, Any]: """ Retrieve detailed information about a specific comment by ID. Parameters: - id (str, required): The comment's unique ID. Returns: - success (bool) - data (dict): If successful, contains comment details: - id, content, created_at, user, post, etc. - error (dict, optional) - rate_limits (dict) Notes: - Returns an error if the comment is not found. """ params = {k: v for k, v in {"id": id}.items() if v is not None} logger.info("comments.get_comment called", extra=params) comment_data, rate_limits, error = execute_and_check_query( COMMENT_QUERY, {"id": id}, "comment", id ) if error: return format_response(False, error=error, rate_limits=rate_limits) return format_response(True, data=comment_data, rate_limits=rate_limits)