Skip to main content
Glama

update_pull_request_branch

Synchronize a pull request branch with the latest changes from its base branch to resolve conflicts and maintain up-to-date code.

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 that executes the GitHub API request to update the pull request branch with the latest changes.
    export async function updatePullRequestBranch(
      owner: string,
      repo: string,
      pullNumber: number,
      expectedHeadSha?: string
    ): Promise<void> {
      await githubRequest(
        `https://api.github.com/repos/${owner}/${repo}/pulls/${pullNumber}/update-branch`,
        {
          method: "PUT",
          body: expectedHeadSha ? { expected_head_sha: expectedHeadSha } : undefined,
        }
      );
    }
  • Zod input schema defining parameters for the tool: owner, repo, pull_number, and optional expected_head_sha.
    export const UpdatePullRequestBranchSchema = z.object({
      owner: z.string().describe("Repository owner (username or organization)"),
      repo: z.string().describe("Repository name"),
      pull_number: z.number().describe("Pull request number"),
      expected_head_sha: z.string().optional().describe("The expected SHA of the pull request's HEAD ref")
    });
  • index.ts:185-189 (registration)
    Tool registration in the listTools response, including name, description, and input schema reference.
    {
      name: "update_pull_request_branch",
      description: "Update a pull request branch with the latest changes from the base branch",
      inputSchema: zodToJsonSchema(pulls.UpdatePullRequestBranchSchema)
    },
  • Dispatcher case in the central CallToolRequest handler that parses args and invokes the specific updatePullRequestBranch function.
    case "update_pull_request_branch": {
      const args = pulls.UpdatePullRequestBranchSchema.parse(request.params.arguments);
      const { owner, repo, pull_number, expected_head_sha } = args;
      await pulls.updatePullRequestBranch(owner, repo, pull_number, expected_head_sha);
      return {
        content: [{ type: "text", text: JSON.stringify({ success: true }, null, 2) }],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It indicates a mutation ('update') but doesn't specify permissions required, whether it's reversible, rate limits, or what happens on failure (e.g., conflicts). For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding operational behavior.

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 that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse.

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

Completeness3/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 minimal. It covers the basic purpose but lacks details on behavior, error handling, or output. Given the complexity (updating a pull request branch) and absence of structured fields, it should provide more context to be fully helpful.

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 well-documented in the schema. The description adds no additional parameter semantics beyond implying the tool updates a branch, which aligns with the schema's parameters (owner, repo, pull_number, expected_head_sha). Baseline 3 is appropriate when schema does 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 action ('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' or 'create_pull_request' by focusing on branch synchronization rather than merging or creation. However, it doesn't explicitly differentiate from all sibling tools in the list.

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_pull_request', nor does it mention prerequisites or exclusions. It states what the tool does but 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

Related 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/tuanle96/mcp-github'

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