Skip to main content
Glama

get_pull_request

Retrieve pull request details including state, author, reviewers, and merge status from Bitbucket repositories to track development progress.

Instructions

Get information about a pull request.

Args: repo_slug: Repository slug pr_id: Pull request ID Returns: PR info including state, author, reviewers, and merge status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
pr_idYes

Implementation Reference

  • MCP tool handler function for 'get_pull_request'. Fetches PR details via BitbucketClient and formats output using PullRequestDetail model.
    @mcp.tool() @handle_bitbucket_error @formatted def get_pull_request(repo_slug: str, pr_id: int) -> dict: """Get information about a pull request. Args: repo_slug: Repository slug pr_id: Pull request ID Returns: PR info including state, author, reviewers, and merge status """ client = get_client() result = client.get_pull_request(repo_slug, pr_id) if not result: return not_found_response("PR", f"#{pr_id}") return PullRequestDetail.from_api(result, client.extract_pr_url(result)).model_dump()
  • BitbucketClient helper method that makes the actual Bitbucket API request to retrieve pull request details.
    def get_pull_request( self, repo_slug: str, pr_id: int ) -> Optional[dict[str, Any]]: """Get pull request by ID. Args: repo_slug: Repository slug pr_id: Pull request ID Returns: PR info or None if not found """ return self._request( "GET", self._repo_path(repo_slug, "pullrequests", str(pr_id)), )
  • Pydantic model PullRequestDetail used for output schema and formatting of the get_pull_request tool response.
    class PullRequestDetail(BaseModel): """PR info for get responses.""" id: int title: str description: str = "" state: str author: Optional[str] = None source_branch: Optional[str] = None destination_branch: Optional[str] = None created: Optional[str] = None updated: Optional[str] = None url: str = "" comment_count: int = 0 task_count: int = 0 @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, url: str = "") -> "PullRequestDetail": return cls( id=data.get("id", 0), title=data.get("title", ""), description=data.get("description", ""), state=data.get("state", ""), author=(data.get("author") or {}).get("display_name"), source_branch=(data.get("source") or {}).get("branch", {}).get("name"), destination_branch=(data.get("destination") or {}).get("branch", {}).get("name"), created=data.get("created_on"), updated=data.get("updated_on"), url=url, comment_count=data.get("comment_count", 0), task_count=data.get("task_count", 0), )

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