Skip to main content
Glama

add_pull_request

Creates a pull request in Backlog by specifying project, repository, summary, description, base branch, and target branch, with optional issue linking and assignee notification.

Instructions

Creates a new pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assigneeIdNoUser ID of the assignee
baseYesBase branch name
branchYesBranch name to merge
descriptionYesCreates a new pull request
issueIdNoIssue ID to link
notifiedUserIdNoUser IDs to notify
projectIdOrKeyYesProject ID or project key
repoIdOrNameYesRepository ID or name
summaryYesSummary of the pull request

Implementation Reference

  • Registration of the add_pull_request tool within the 'git' toolset in the allTools function.
    name: 'git', description: 'Tools for managing Git repositories and pull requests.', enabled: false, tools: [ getGitRepositoriesTool(backlog, helper), getGitRepositoryTool(backlog, helper), getPullRequestsTool(backlog, helper), getPullRequestsCountTool(backlog, helper), getPullRequestTool(backlog, helper), addPullRequestTool(backlog, helper), updatePullRequestTool(backlog, helper), getPullRequestCommentsTool(backlog, helper), addPullRequestCommentTool(backlog, helper), updatePullRequestCommentTool(backlog, helper), ], },
  • The core handler logic that resolves project ID/key and repository ID/name, then invokes the Backlog SDK to create a 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 ); },
  • Input schema for the add_pull_request tool, defining parameters like project, repository, branches, summary, and optional fields using Zod.
    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') ), }));

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nulab/backlog-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server