Skip to main content
Glama

create_pull_request

Automates GitHub pull request creation by specifying repository owner, repo name, title, branch details, and optional draft or maintainer permissions. Simplifies code collaboration workflows.

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

  • Handler for the create_pull_request tool: parses input arguments using the schema and delegates to the createPullRequest function in pulls module, returning the result as text content.
    case "create_pull_request": {
      const args = pulls.CreatePullRequestSchema.parse(request.params.arguments);
      const pullRequest = await pulls.createPullRequest(args);
      return {
        content: [{ type: "text", text: JSON.stringify(pullRequest, null, 2) }],
      };
    }
  • Zod schema defining the input parameters for creating a pull request, used for validation in both registration and handler.
    export const CreatePullRequestSchema = z.object({
      owner: z.string().describe("Repository owner (username or organization)"),
      repo: z.string().describe("Repository name"),
      title: z.string().describe("Pull request title"),
      body: z.string().optional().describe("Pull request body/description"),
      head: z.string().describe("The name of the branch where your changes are implemented"),
      base: z.string().describe("The name of the branch you want the changes pulled into"),
      draft: z.boolean().optional().describe("Whether to create the pull request as a draft"),
      maintainer_can_modify: z.boolean().optional().describe("Whether maintainers can modify the pull request")
    });
  • index.ts:100-104 (registration)
    Tool registration in the ListTools handler, specifying name, description, and input schema.
    {
      name: "create_pull_request",
      description: "Create a new pull request in a GitHub repository",
      inputSchema: zodToJsonSchema(pulls.CreatePullRequestSchema),
    },
  • Core implementation function that makes the GitHub API POST request to create the pull request and parses the response.
    export async function createPullRequest(
      params: z.infer<typeof CreatePullRequestSchema>
    ): Promise<z.infer<typeof GitHubPullRequestSchema>> {
      const { owner, repo, ...options } = CreatePullRequestSchema.parse(params);
    
      const response = await githubRequest(
        `https://api.github.com/repos/${owner}/${repo}/pulls`,
        {
          method: "POST",
          body: options,
        }
      );
    
      return GitHubPullRequestSchema.parse(response);
    }
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 but only states the basic action. It doesn't mention that this is a write operation (implied by 'create'), potential authentication requirements, rate limits, error conditions, or what happens on success (e.g., returns a PR object). For a mutation tool with zero annotation coverage, this is insufficient.

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 function without unnecessary words. It's appropriately sized for a tool with comprehensive schema documentation and gets straight to the point.

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 complex write operation with 8 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what happens after creation, error handling, authentication needs, or how this differs from similar tools. The schema handles parameter documentation, but the description fails to provide necessary behavioral context.

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 with clear descriptions for all 8 parameters). This meets the baseline of 3 for high schema coverage, but doesn't provide additional context like parameter relationships or GitHub-specific conventions.

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 ('new pull request in a GitHub repository'), making the purpose immediately understandable. However, it doesn't distinguish this tool from sibling tools like 'merge_pull_request' or 'update_pull_request_branch', which would require explicit differentiation for a perfect score.

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 'create_issue' or 'list_pull_requests', nor does it mention prerequisites such as having appropriate repository permissions or existing branches. It's a basic statement of function without contextual usage information.

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