Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

create-pull-request

Create a new pull request in a GitHub repository by specifying the source and target branches, title, and description to propose code changes for review.

Instructions

Create a new pull request in a GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseYesThe name of the branch you want the changes pulled into
bodyNoPull request body/description
draftNoWhether to create the pull request as a draft
headYesThe name of the branch where your changes are implemented
maintainer_can_modifyNoWhether maintainers can modify the pull request
ownerYesRepository owner (username or organization)
repoYesRepository name
titleYesPull request title

Implementation Reference

  • The core handler function that parses the input arguments using CreatePullRequestSchema, calls the GitHub Octokit API to create the pull request, processes the response, and handles errors with tryCatchAsync.
    export async function createPullRequest(args: unknown): Promise<any> {
      const { owner, repo, title, head, base, body, draft, maintainer_can_modify } = CreatePullRequestSchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().pulls.create({
          owner,
          repo,
          title,
          head,
          base,
          body,
          draft,
          maintainer_can_modify,
        });
    
        return {
          id: data.id,
          number: data.number,
          title: data.title,
          state: data.state,
          user: data.user ? {
            login: data.user.login,
            id: data.user.id,
          } : null,
          created_at: data.created_at,
          updated_at: data.updated_at,
          head: {
            ref: data.head.ref,
            sha: data.head.sha,
            repo: data.head.repo ? {
              name: data.head.repo.name,
              full_name: data.head.repo.full_name,
            } : null,
          },
          base: {
            ref: data.base.ref,
            sha: data.base.sha,
            repo: data.base.repo ? {
              name: data.base.repo.name,
              full_name: data.base.repo.full_name,
            } : null,
          },
          body: data.body,
          draft: data.draft,
          url: data.html_url,
        };
      }, 'Failed to create pull request');
    }
  • Zod schema used for input validation in the createPullRequest handler. Extends OwnerRepoSchema with PR-specific fields.
    export const CreatePullRequestSchema = OwnerRepoSchema.extend({
      title: z.string().min(1, 'Pull request title is required'),
      head: z.string().min(1, 'Head branch is required'),
      base: z.string().min(1, 'Base branch is required'),
      body: z.string().optional(),
      draft: z.boolean().optional(),
      maintainer_can_modify: z.boolean().optional(),
    });
  • src/server.ts:766-808 (registration)
    Tool registration entry in the listTools handler, defining the tool's name, description, and input schema for MCP protocol compliance.
    {
      name: 'create-pull-request',
      description: 'Create a new pull request in a GitHub repository',
      inputSchema: {
        type: 'object',
        properties: {
          owner: {
            type: 'string',
            description: 'Repository owner (username or organization)',
          },
          repo: {
            type: 'string',
            description: 'Repository name',
          },
          title: {
            type: 'string',
            description: 'Pull request title',
          },
          body: {
            type: 'string',
            description: 'Pull request body/description',
          },
          head: {
            type: 'string',
            description: 'The name of the branch where your changes are implemented',
          },
          base: {
            type: 'string',
            description: 'The name of the branch you want the changes pulled into',
          },
          draft: {
            type: 'boolean',
            description: 'Whether to create the pull request as a draft',
          },
          maintainer_can_modify: {
            type: 'boolean',
            description: 'Whether maintainers can modify the pull request',
          },
        },
        required: ['owner', 'repo', 'title', 'head', 'base'],
        additionalProperties: false,
      },
    },
  • Dispatch case in the CallToolRequest handler switch statement that invokes the createPullRequest function.
    case 'create-pull-request':
      result = await createPullRequest(parsedArgs);
      break;
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('create') which implies a write operation, but doesn't disclose any behavioral traits like authentication requirements, rate limits, what happens on failure, whether the PR is automatically opened or requires further steps, or how conflicts are handled. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 states the core purpose without unnecessary words. It's perfectly front-loaded with the essential information. There's zero waste or redundancy in the phrasing.

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 8 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what happens after creation (e.g., PR status, review process), error conditions, authentication needs, or GitHub-specific behaviors. The agent lacks crucial context about how this tool interacts with the GitHub ecosystem and what to expect from its execution.

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?

The description adds no parameter-specific information beyond what's already in the schema (which has 100% coverage). It doesn't explain relationships between parameters (e.g., that 'head' and 'base' must be different branches), provide examples, or clarify edge cases. With complete schema documentation, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.

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 ('create') and resource ('pull request in a GitHub repository'), making the purpose immediately understandable. It distinguishes this tool from siblings like 'create-issue' or 'create-branch' by specifying the type of resource being created. However, it doesn't explicitly differentiate from 'merge-pull-request' or 'update-pull-request-branch' in terms of when to create versus modify existing pull requests.

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. It doesn't mention prerequisites (e.g., needing existing branches), when not to use it (e.g., if changes aren't ready for review), or how it differs from similar tools like 'create-issue' for non-code changes. The agent must infer usage from the tool name alone.

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