Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

update-pull-request-branch

Update a pull request branch with the latest changes from the base branch to resolve merge conflicts and ensure code is current.

Instructions

Update a pull request branch with the latest changes from the base branch

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expected_head_shaNoThe expected SHA of the pull request's HEAD ref
ownerYesRepository owner (username or organization)
pull_numberYesPull request number
repoYesRepository name

Implementation Reference

  • The core handler function implementing the 'update-pull-request-branch' tool. It validates input using Zod schema, calls the GitHub API's pulls.updateBranch method, and returns the result.
    export async function updatePullRequestBranch(args: unknown): Promise<any> { const { owner, repo, pull_number, expected_head_sha } = UpdatePullRequestBranchSchema.parse(args); const github = getGitHubApi(); return tryCatchAsync(async () => { const { data } = await github.getOctokit().pulls.updateBranch({ owner, repo, pull_number, expected_head_sha, }); return { message: data.message, url: data.url, }; }, 'Failed to update pull request branch'); }
  • Zod schema for validating the input parameters of the update-pull-request-branch tool.
    export const UpdatePullRequestBranchSchema = OwnerRepoSchema.extend({ pull_number: z.number().int().positive(), expected_head_sha: z.string().optional(), });
  • src/server.ts:950-976 (registration)
    Tool registration in the ListTools response, defining the tool name, description, and input schema.
    { name: 'update-pull-request-branch', description: 'Update a pull request branch with the latest changes from the base branch', inputSchema: { type: 'object', properties: { owner: { type: 'string', description: 'Repository owner (username or organization)', }, repo: { type: 'string', description: 'Repository name', }, pull_number: { type: 'number', description: 'Pull request number', }, expected_head_sha: { type: 'string', description: 'The expected SHA of the pull request\'s HEAD ref', }, }, required: ['owner', 'repo', 'pull_number'], additionalProperties: false, }, },
  • Dispatch case in the CallToolRequest handler that invokes the updatePullRequestBranch function.
    case 'update-pull-request-branch': result = await updatePullRequestBranch(parsedArgs); break;

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/piyushgIITian/github-enterprice-mcp'

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