list_pull_requests
Retrieve pull requests from a Bitbucket Cloud repository with filtering options to view open, merged, declined, or superseded requests.
Instructions
List pull requests for a repository with optional filtering by state.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| repo_slug | Yes | The repository slug | |
| state | No | Filter by state | |
| page | No | Page number | |
| pagelen | No | Results per page |
Implementation Reference
- src/tools/index.ts:925-928 (handler)Tool handler case that parses the input parameters using Zod schema and delegates to PullRequestsAPI.list for execution.case 'list_pull_requests': { const params = toolSchemas.list_pull_requests.parse(args); return this.prs.list(params); }
- src/tools/index.ts:53-62 (schema)Zod schema definition for validating input parameters of the list_pull_requests tool.list_pull_requests: z.object({ workspace: z.string().describe('The workspace slug'), repo_slug: z.string().describe('The repository slug'), state: z .enum(['OPEN', 'MERGED', 'DECLINED', 'SUPERSEDED']) .optional() .describe('Filter by state'), page: z.number().optional().describe('Page number'), pagelen: z.number().optional().describe('Results per page'), }),
- src/tools/index.ts:389-407 (registration)MCP tool registration including name, description, and input schema for list_pull_requests.{ name: 'list_pull_requests', description: 'List pull requests for a repository with optional filtering by state.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, repo_slug: { type: 'string', description: 'The repository slug' }, state: { type: 'string', enum: ['OPEN', 'MERGED', 'DECLINED', 'SUPERSEDED'], description: 'Filter by state', }, page: { type: 'number', description: 'Page number' }, pagelen: { type: 'number', description: 'Results per page' }, }, required: ['workspace', 'repo_slug'], }, },
- src/api/pullrequests.ts:16-22 (helper)Core API helper method that performs the HTTP GET request to Bitbucket's pull requests endpoint.async list(params: ListPullRequestsParams): Promise<PaginatedResponse<BitbucketPullRequest>> { const { workspace, repo_slug, ...queryParams } = params; return this.client.get<PaginatedResponse<BitbucketPullRequest>>( `/repositories/${workspace}/${repo_slug}/pullrequests`, queryParams as Record<string, string | number | undefined> ); }
- src/types/index.ts:283-289 (schema)TypeScript interface defining the parameters for listing pull requests.export interface ListPullRequestsParams { workspace: string; repo_slug: string; state?: 'OPEN' | 'MERGED' | 'DECLINED' | 'SUPERSEDED'; page?: number; pagelen?: number; }