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;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks critical behavioral details. It doesn't disclose whether this operation requires specific permissions, is reversible, affects other branches, or has rate limits. 'Update' implies mutation, but the safety profile and side effects are undocumented.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It front-loads the core action and scope appropriately, making it easy to parse without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is incomplete. It misses behavioral context (permissions, side effects), usage guidance, and output details. Given the complexity of updating a pull request branch, more information is needed for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are fully documented in the schema. The description adds no additional meaning about parameters beyond implying 'pull_number' identifies the target. Baseline 3 is appropriate as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('update') and resource ('pull request branch') with specific scope ('with the latest changes from the base branch'). It distinguishes from siblings like 'merge-pull-request' by focusing on branch synchronization rather than final integration, though it doesn't explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'merge-pull-request' or 'create-branch', nor does it mention prerequisites (e.g., branch conflicts, permissions) or typical workflows. It only states what the tool does, not when it's appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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