Skip to main content
Glama

list_pr_comments

Retrieve comments from a Bitbucket pull request to review feedback, track discussions, and monitor changes. Provides author details, content, and timestamps for each comment.

Instructions

List comments on a pull request.

Args:
    repo_slug: Repository slug
    pr_id: Pull request ID
    limit: Maximum number of results (default: 50)

Returns:
    List of comments with author, content, and timestamps

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
pr_idYes
limitNo

Implementation Reference

  • MCP tool handler for 'list_pr_comments': validates input, calls BitbucketClient.list_pr_comments, formats response using CommentSummary models.
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
    def list_pr_comments(
        repo_slug: str,
        pr_id: int,
        limit: int = 50,
    ) -> dict:
        """List comments on a pull request.
    
        Args:
            repo_slug: Repository slug
            pr_id: Pull request ID
            limit: Maximum number of results (default: 50)
    
        Returns:
            List of comments with author, content, and timestamps
        """
        client = get_client()
        comments = client.list_pr_comments(repo_slug, pr_id, limit=validate_limit(limit))
        return {
            "pr_id": pr_id,
            "comments": [CommentSummary.from_api(c).model_dump() for c in comments],
        }
  • Pydantic model CommentSummary used for input/output schema and formatting of PR comments in the tool response.
    class CommentSummary(BaseModel):
        """Comment info for list responses."""
    
        id: int
        author: Optional[str] = None
        content: str = ""
        created: Optional[str] = None
        updated: Optional[str] = None
        inline: Optional[dict] = None
    
        @field_validator("created", "updated", mode="before")
        @classmethod
        def truncate_ts(cls, v: Any) -> Optional[str]:
            return truncate_timestamp(v)
    
        @classmethod
        def from_api(cls, data: dict) -> "CommentSummary":
            return cls(
                id=data.get("id", 0),
                author=(data.get("user") or {}).get("display_name"),
                content=(data.get("content") or {}).get("raw", ""),
                created=data.get("created_on"),
                updated=data.get("updated_on"),
                inline=data.get("inline"),
            )
  • BitbucketClient helper method implementing the low-level API call to list PR comments using paginated_list.
    def list_pr_comments(
        self,
        repo_slug: str,
        pr_id: int,
        limit: int = 50,
    ) -> list[dict[str, Any]]:
        """List comments on a pull request.
    
        Args:
            repo_slug: Repository slug
            pr_id: Pull request ID
            limit: Maximum results to return
    
        Returns:
            List of comment info dicts
        """
        return self._paginated_list(
            self._repo_path(repo_slug, "pullrequests", str(pr_id), "comments"),
            limit=limit,
        )
  • src/server.py:913-913 (registration)
    @mcp.tool() decorator registers the list_pr_comments function as an MCP tool.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JaviMaligno/mcp-server-bitbucket'

If you have feedback or need assistance with the MCP directory API, please join our Discord server