update_pull_request
Modify an existing pull request in Backlog by updating its summary, description, assignee, status, or linked issue to reflect changes and progress.
Instructions
Updates an existing pull request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | The numeric ID of the project (e.g., 12345) | |
| projectKey | No | The key of the project (e.g., 'PROJECT') | |
| repoId | No | Repository ID | |
| repoName | No | Repository name | |
| number | Yes | Pull request number | |
| summary | No | Summary of the pull request | |
| description | No | Updates an existing pull request | |
| issueId | No | Issue ID to link | |
| assigneeId | No | User ID of the assignee | |
| notifiedUserId | No | User IDs to notify | |
| statusId | No | Status ID |
Implementation Reference
- src/tools/updatePullRequest.ts:75-122 (handler)The core handler implementation for the 'update_pull_request' tool. It sets the tool name, description, input/output schemas, and the async handler that resolves project and repository identifiers and invokes the Backlog API to patch the pull request.export const updatePullRequestTool = ( backlog: Backlog, { t }: TranslationHelper ): ToolDefinition< ReturnType<typeof updatePullRequestSchema>, (typeof PullRequestSchema)['shape'] > => { return { name: 'update_pull_request', description: t( 'TOOL_UPDATE_PULL_REQUEST_DESCRIPTION', 'Updates an existing pull request' ), schema: z.object(updatePullRequestSchema(t)), outputSchema: PullRequestSchema, handler: async ({ projectId, projectKey, repoId, repoName, number, ...params }) => { const result = resolveIdOrKey( 'project', { id: projectId, key: projectKey }, t ); if (!result.ok) { throw result.error; } const resultRepo = resolveIdOrKey( 'repository', { id: repoId, key: repoName }, t ); if (!resultRepo.ok) { throw resultRepo.error; } return backlog.patchPullRequest( result.value, String(resultRepo.value), number, params ); }, }; };
- src/tools/updatePullRequest.ts:8-73 (schema)Input schema for the update_pull_request tool, defining optional project/repo IDs/keys, required PR number, and optional fields like summary, description, issue link, assignee, notified users, and status.const updatePullRequestSchema = buildToolSchema((t) => ({ projectId: z .number() .optional() .describe( t( 'TOOL_UPDATE_PULL_REQUEST_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)' ) ), projectKey: z .string() .optional() .describe( t( 'TOOL_UPDATE_PULL_REQUEST_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')" ) ), repoId: z .number() .optional() .describe(t('TOOL_UPDATE_PULL_REQUEST_REPO_ID', 'Repository ID')), repoName: z .string() .optional() .describe(t('TOOL_UPDATE_PULL_REQUEST_REPO_NAME', 'Repository name')), number: z .number() .describe(t('TOOL_UPDATE_PULL_REQUEST_NUMBER', 'Pull request number')), summary: z .string() .optional() .describe( t('TOOL_UPDATE_PULL_REQUEST_SUMMARY', 'Summary of the pull request') ), description: z .string() .optional() .describe( t( 'TOOL_UPDATE_PULL_REQUEST_DESCRIPTION', 'Description of the pull request' ) ), issueId: z .number() .optional() .describe(t('TOOL_UPDATE_PULL_REQUEST_ISSUE_ID', 'Issue ID to link')), assigneeId: z .number() .optional() .describe( t('TOOL_UPDATE_PULL_REQUEST_ASSIGNEE_ID', 'User ID of the assignee') ), notifiedUserId: z .array(z.number()) .optional() .describe( t('TOOL_UPDATE_PULL_REQUEST_NOTIFIED_USER_ID', 'User IDs to notify') ), statusId: z .number() .optional() .describe(t('TOOL_UPDATE_PULL_REQUEST_STATUS_ID', 'Status ID')), }));
- src/tools/tools.ts:141-141 (registration)Registration of the updatePullRequestTool within the 'git' toolset group in the allTools export.updatePullRequestTool(backlog, helper),
- src/tools/tools.ts:48-48 (registration)Import of the updatePullRequestTool for registration.import { updatePullRequestTool } from './updatePullRequest.js';
- Usage of the resolveIdOrKey helper to resolve project and repository IDs or keys before calling the API.const result = resolveIdOrKey( 'project', { id: projectId, key: projectKey }, t ); if (!result.ok) { throw result.error; } const resultRepo = resolveIdOrKey( 'repository', { id: repoId, key: repoName }, t ); if (!resultRepo.ok) { throw resultRepo.error; } return backlog.patchPullRequest( result.value, String(resultRepo.value), number, params ); }, }; };