def jira_comments_query(
        self, issue_key: str, author_email: Optional[str] = None
    ) -> dict:
        """
        Retrieve all comments for a given Jira issue, optionally filtering by the author's email.

        This function fetches comments from a specified Jira issue and returns them as a structured
        JSON response. If an `author_email` is provided, only comments from that specific author
        will be included.

        Args:
            issue_key (str): The Jira issue key for which to retrieve comments.
            author_email (str, Optional): filters comments by the author's email.

        Returns:
            dict: A dictionary containing:
                - 'error' (bool): Indicates whether the request was successful.
                - 'message' (str): A descriptive message about the result.
                - 'comments' (list, optional): A list of comments, where each comment includes:
                    - 'id' (str): The unique identifier of the comment.
                    - 'author' (str): The display name of the comment's author.
                    - 'author_email' (str): The author's email address.
                    - 'body' (str): The content of the comment.
                    - 'created_at' (str): The timestamp when the comment was created.
                    - 'updated_at' (str): The timestamp when the comment was last updated.

        """
        error = False

        try:
            issue = self.jira.issue(issue_key)

            all_comments = list(issue.fields.comment.comments)
            filtered_results = []

            for comment in all_comments:
                if (
                    author_email is not None
                    and author_email not in comment.author.emailAddress
                ):
                    continue

                filtered_results.append(
                    {
                        "id": comment.id,
                        "author": comment.author.displayName,
                        "author_email": comment.author.emailAddress,
                        "body": comment.body,
                        "created_at": comment.created,
                        "updated_at": comment.updated,
                    }
                )

            message = f'All the comments in the issue key "{issue_key}"'
        except Exception:
            error = True
            message = "Unable to fetch comments due to some error"

        response = {"error": error, "message": message}

        if error is False:
            response["comments"] = filtered_results

        return response

        Retrieve all comments for a given Jira issue, optionally filtering by the author's email.

        This function fetches comments from a specified Jira issue and returns them as a structured
        JSON response. If an `author_email` is provided, only comments from that specific author
        will be included.

        Args:
            issue_key (str): The Jira issue key for which to retrieve comments.
            author_email (str, Optional): filters comments by the author's email.

        Returns:
            dict: A dictionary containing:
                - 'error' (bool): Indicates whether the request was successful.
                - 'message' (str): A descriptive message about the result.
                - 'comments' (list, optional): A list of comments, where each comment includes:
                    - 'id' (str): The unique identifier of the comment.
                    - 'author' (str): The display name of the comment's author.
                    - 'author_email' (str): The author's email address.
                    - 'body' (str): The content of the comment.
                    - 'created_at' (str): The timestamp when the comment was created.
                    - 'updated_at' (str): The timestamp when the comment was last updated.

        
llama-index-integrations/tools/llama-index-tools-jira/llama_index/tools/jira/base.py