Skip to main content
Glama
kunwarVivek

mcp-github-project-manager

create_pull_request

Create a new pull request in a GitHub repository to propose and review code changes before merging into the main branch.

Instructions

Create a new pull request in a GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
bodyNo
headYes
baseYes
draftNo

Implementation Reference

  • The core handler function that creates a pull request using GitHub's Octokit REST API. This is the exact implementation of the tool logic.
    async createPullRequest(data: {
      title: string;
      body?: string;
      head: string;
      base: string;
      draft?: boolean;
    }): Promise<{ number: number; id: number; title: string; state: string; url: string }> {
      try {
        const octokit = this.factory.getOctokit();
        const config = this.factory.getConfig();
    
        const response = await octokit.rest.pulls.create({
          owner: config.owner,
          repo: config.repo,
          title: data.title,
          body: data.body || '',
          head: data.head,
          base: data.base,
          draft: data.draft || false
        });
    
        return {
          number: response.data.number,
          id: response.data.id,
          title: response.data.title,
          state: response.data.state,
          url: response.data.html_url
        };
      } catch (error) {
        throw this.mapErrorToMCPError(error);
      }
    }
  • ToolDefinition object defining the tool name, description, input schema (createPullRequestSchema), and examples.
    export const createPullRequestTool: ToolDefinition<CreatePullRequestArgs> = {
      name: "create_pull_request",
      description: "Create a new pull request in a GitHub repository",
      schema: createPullRequestSchema as unknown as ToolSchema<CreatePullRequestArgs>,
      examples: [
        {
          name: "Create feature PR",
          description: "Create a pull request for a new feature",
          args: {
            title: "Add user authentication",
            body: "Implements OAuth 2.0 authentication with Auth0",
            head: "feature/auth",
            base: "main"
          }
        }
      ]
    };
  • Registration of the createPullRequestTool in the central ToolRegistry singleton.
    this.registerTool(createPullRequestTool);
  • Dispatch handler in main MCP server that routes tool calls to ProjectManagementService.createPullRequest.
    case "create_pull_request":
      return await this.service.createPullRequest(args);
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/kunwarVivek/mcp-github-project-manager'

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