get_pull_requests
Retrieve a list of pull requests from a repository by specifying project ID, repository name, and optional filters like status, assignee, or issue IDs. Supports pagination for efficient management.
Instructions
Returns list of pull requests for a repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assigneeId | No | Assignee user IDs | |
| count | No | Number of pull requests to retrieve | |
| createdUserId | No | Created user IDs | |
| issueId | No | Issue IDs | |
| offset | No | Offset for pagination | |
| projectIdOrKey | Yes | Project ID or project key | |
| repoIdOrName | Yes | Repository ID or name | |
| statusId | No | Status IDs |
Implementation Reference
- src/tools/getPullRequests.ts:78-100 (handler)The async handler function that implements the core logic of the 'get_pull_requests' tool: resolves project ID or key and repository ID or name using utility functions, then calls the Backlog API's getPullRequests method with the resolved parameters.handler: async ({ projectId, projectKey, repoId, repoName, ...params }) => { const result = resolveIdOrKey( 'project', { id: projectId, key: projectKey }, t ); if (!result.ok) { throw result.error; } const repoResult = resolveIdOrName( 'repository', { id: repoId, name: repoName }, t ); if (!repoResult.ok) { throw repoResult.error; } return backlog.getPullRequests( result.value, String(repoResult.value), params ); },
- src/tools/getPullRequests.ts:8-61 (schema)Input schema definition using Zod for the 'get_pull_requests' tool parameters, including optional project/repo identifiers and filters like status, assignee, pagination.const getPullRequestsSchema = buildToolSchema((t) => ({ projectId: z .number() .optional() .describe( t( 'TOOL_GET_PULL_REQUESTS_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)' ) ), projectKey: z .string() .optional() .describe( t( 'TOOL_GET_PULL_REQUESTS_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')" ) ), repoId: z .number() .optional() .describe(t('TOOL_GET_PULL_REQUESTS_REPO_ID', 'Repository ID')), repoName: z .string() .optional() .describe(t('TOOL_GET_PULL_REQUESTS_REPO_NAME', 'Repository name')), statusId: z .array(z.number()) .optional() .describe(t('TOOL_GET_PULL_REQUESTS_STATUS_ID', 'Status IDs')), assigneeId: z .array(z.number()) .optional() .describe(t('TOOL_GET_PULL_REQUESTS_ASSIGNEE_ID', 'Assignee user IDs')), issueId: z .array(z.number()) .optional() .describe(t('TOOL_GET_PULL_REQUESTS_ISSUE_ID', 'Issue IDs')), createdUserId: z .array(z.number()) .optional() .describe(t('TOOL_GET_PULL_REQUESTS_CREATED_USER_ID', 'Created user IDs')), offset: z .number() .optional() .describe(t('TOOL_GET_PULL_REQUESTS_OFFSET', 'Offset for pagination')), count: z .number() .optional() .describe( t('TOOL_GET_PULL_REQUESTS_COUNT', 'Number of pull requests to retrieve') ), }));
- src/tools/tools.ts:127-127 (registration)Registration of the 'get_pull_requests' tool by instantiating getPullRequestsTool with Backlog client and translation helper, and adding it to the 'git' toolset group.getPullRequestsTool(backlog, helper),
- src/tools/tools.ts:29-29 (registration)Import of the getPullRequestsTool function definition.import { getPullRequestsTool } from './getPullRequests.js';
- src/tools/getPullRequests.ts:6-6 (helper)Import of utility functions used in the handler to resolve project/repo identifiers from ID/key or ID/name.import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';