bitbucket_get_pull_request
Retrieve detailed pull request information from a Bitbucket repository by providing project key, repository slug, and pull request ID.
Instructions
Get detailed pull request information
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | Project key | |
| repo | Yes | Repository slug | |
| prId | Yes | Pull request ID |
Implementation Reference
- src/tools/pr-tools.ts:78-101 (handler)The handler function for 'bitbucket_get_pull_request'. It parses args using prRefShape (project, repo, prId), checks 'read_pr' permission, calls prApi.get(), and returns the PullRequest data.
bitbucket_get_pull_request: async (args: unknown): Promise<McpToolResult> => { const start = Date.now(); try { const input = z.object(prRefShape).parse(args); requirePermission(config, 'read_pr'); log('info', 'tool start', { operation: 'tool_execute', toolName: 'bitbucket_get_pull_request', }); const result = await prApi.get(input.project, input.repo, input.prId); log('info', 'tool end', { toolName: 'bitbucket_get_pull_request', durationMs: Date.now() - start, }); return textResult(result); } catch (err) { log('error', 'tool error', { toolName: 'bitbucket_get_pull_request', error: String(err), durationMs: Date.now() - start, }); return errorResult('GET_PR_FAILED', err instanceof Error ? err.message : String(err)); } }, - src/tools/schemas.ts:32-32 (schema)Input schema prRefShape for the tool, defining required fields: project (string), repo (string), and prId (positive integer).
export const prRefShape = { project, repo, prId } as const; - src/tools/registry.ts:63-68 (registration)Registration entry pairing tool name 'bitbucket_get_pull_request' with description, prRefShape schema, and handler reference h.pr.bitbucket_get_pull_request.
{ name: 'bitbucket_get_pull_request', description: 'Get detailed pull request information', shape: prRefShape, handler: h.pr.bitbucket_get_pull_request, }, - PullRequestApi.get() method called by the handler. Makes a GET request to /projects/{project}/repos/{repo}/pull-requests/{prId} and returns a PullRequest response.
async get(project: string, repo: string, prId: number): Promise<PullRequest> { return this.client.requestJson<PullRequest>( `/projects/${project}/repos/${repo}/pull-requests/${prId}` ); }