add_pull_request
Create a new pull request in Backlog by specifying summary, description, base branch, and merge branch to propose code changes for review.
Instructions
Creates a new 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 | |
| summary | Yes | Summary of the pull request | |
| description | Yes | Creates a new pull request | |
| base | Yes | Base branch name | |
| branch | Yes | Branch name to merge | |
| issueId | No | Issue ID to link | |
| assigneeId | No | User ID of the assignee | |
| notifiedUserId | No | User IDs to notify |
Implementation Reference
- src/tools/addPullRequest.ts:84-106 (handler)The handler function that executes the tool logic: resolves project and repository using helpers, then calls backlog.postPullRequest to create the pull request.handler: async ({ projectId, projectKey, repoId, repoName, ...params }) => { const result = resolveIdOrKey( 'project', { id: projectId, key: projectKey }, t ); if (!result.ok) { throw result.error; } const repoRes = resolveIdOrName( 'repository', { id: repoId, name: repoName }, t ); if (!repoRes.ok) { throw repoRes.error; } return backlog.postPullRequest( result.value, String(repoRes.value), params ); },
- src/tools/addPullRequest.ts:8-67 (schema)Input schema definition for the add_pull_request tool using Zod and buildToolSchema with translation helpers.const addPullRequestSchema = buildToolSchema((t) => ({ projectId: z .number() .optional() .describe( t( 'TOOL_ADD_PULL_REQUEST_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)' ) ), projectKey: z .string() .optional() .describe( t( 'TOOL_ADD_PULL_REQUEST_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')" ) ), repoId: z .number() .optional() .describe(t('TOOL_ADD_PULL_REQUEST_REPO_ID', 'Repository ID')), repoName: z .string() .optional() .describe(t('TOOL_ADD_PULL_REQUEST_REPO_NAME', 'Repository name')), summary: z .string() .describe( t('TOOL_ADD_PULL_REQUEST_SUMMARY', 'Summary of the pull request') ), description: z .string() .describe( t('TOOL_ADD_PULL_REQUEST_DESCRIPTION', 'Description of the pull request') ), base: z .string() .describe(t('TOOL_ADD_PULL_REQUEST_BASE', 'Base branch name')), branch: z .string() .describe(t('TOOL_ADD_PULL_REQUEST_BRANCH', 'Branch name to merge')), issueId: z .number() .optional() .describe(t('TOOL_ADD_PULL_REQUEST_ISSUE_ID', 'Issue ID to link')), assigneeId: z .number() .optional() .describe( t('TOOL_ADD_PULL_REQUEST_ASSIGNEE_ID', 'User ID of the assignee') ), notifiedUserId: z .array(z.number()) .optional() .describe( t('TOOL_ADD_PULL_REQUEST_NOTIFIED_USER_ID', 'User IDs to notify') ), }));
- src/tools/tools.ts:140-140 (registration)The addPullRequestTool is instantiated and registered in the 'git' toolset group within the allTools function.addPullRequestTool(backlog, helper),
- src/tools/tools.ts:7-7 (registration)Import of the addPullRequestTool for registration.import { addPullRequestTool } from './addPullRequest.js';
- src/tools/addPullRequest.ts:82-83 (schema)The tool's input schema (z.object(addPullRequestSchema(t))) and output schema (PullRequestSchema) as part of the ToolDefinition.schema: z.object(addPullRequestSchema(t)), outputSchema: PullRequestSchema,