Skip to main content
Glama

create_pull_request

Create Pull Requests in Gitee repositories by specifying source and target branches, title, content, reviewers, labels, and related issues.

Instructions

在 Gitee 仓库中创建 Pull Request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assigneesNoReviewers
baseYesTarget branch name
bodyNoPull Request content
headYesSource branch name
issueNoRelated issue, format: #xxx
labelsNoLabels
milestone_numberNoMilestone number
ownerYesRepository owner path (enterprise, organization, or personal path)
prune_source_branchNoWhether to delete the source branch after merging
repoYesRepository path
testersNoTesters
titleYesPull Request title

Implementation Reference

  • The core function that implements the createPullRequest tool by validating inputs and making a POST request to the Gitee API to create a pull request.
    export async function createPullRequest(options: CreatePullRequestOptions) {
      const { owner, repo, ...rest } = options;
      const validatedOwner = validateOwnerName(owner);
      const validatedRepo = validateRepositoryName(repo);
      const validatedHead = validateBranchName(rest.head);
      const validatedBase = validateBranchName(rest.base);
    
      const url = `/repos/${validatedOwner}/${validatedRepo}/pulls`;
      const body = {
        ...rest,
        head: validatedHead,
        base: validatedBase,
      };
    
      const response = await giteeRequest(url, "POST", body);
    
      return GiteePullRequestSchema.parse(response);
    }
  • Zod schema defining the input parameters for creating a pull request.
    export const CreatePullRequestSchema = z.object({
      // 仓库所属空间地址 (企业、组织或个人的地址 path)
      owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"),
      // 仓库路径 (path)
      repo: z.string().describe("Repository path"),
      // Pull Request 标题
      title: z.string().describe("Pull Request title"),
      // 源分支的名称
      head: z.string().describe("Source branch name"),
      // 目标分支的名称
      base: z.string().describe("Target branch name"),
      // Pull Request 内容
      body: z.string().optional().describe("Pull Request content"),
      // 里程碑序号
      milestone_number: z.number().optional().describe("Milestone number"),
      // 标签
      labels: z.array(z.string()).optional().describe("Labels"),
      // 相关的 Issue,格式为 #xxx
      issue: z.string().optional().describe("Related issue, format: #xxx"),
      // 审查人员
      assignees: z.array(z.string()).optional().describe("Reviewers"),
      // 测试人员
      testers: z.array(z.string()).optional().describe("Testers"),
      // 合并后是否删除源分支
      prune_source_branch: z.boolean().optional().describe("Whether to delete the source branch after merging"),
    });
  • index.ts:190-202 (registration)
    Registration of the 'create_pull_request' tool in the MCP server, including schema reference and handler wrapper that delegates to the pulls module.
    server.registerTool({
      name: "create_pull_request",
      description: "在 Gitee 仓库中创建 Pull Request",
      schema: pullOperations.CreatePullRequestSchema,
      handler: async (params: any) => {
        const { owner, repo, ...rest } = params;
        // 确保 owner 和 repo 参数存在
        if (!owner || !repo) {
          throw new Error("owner 和 repo 参数是必需的");
        }
        return await pullOperations.createPullRequest({ owner, repo, ...rest });
      },
    });
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 offers minimal behavioral insight. It states the action is creation but doesn't disclose permissions needed, whether it's idempotent, error conditions, rate limits, or what happens on success (e.g., PR number returned). For a mutation tool with 12 parameters, this leaves critical gaps.

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 in Chinese that directly states the tool's purpose. It's front-loaded with the core action and resource, with zero wasted words. This is appropriately concise for a tool with well-documented parameters.

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 mutation tool with 12 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns, error handling, authentication requirements, or side effects. The agent lacks critical context to use this tool effectively despite the good parameter schema.

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%, providing clear documentation for all 12 parameters. The description adds no additional parameter semantics beyond what's in the schema (e.g., no examples, formatting tips, or constraints). 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 ('创建' - create) and resource ('Pull Request') with the context ('在 Gitee 仓库中' - in Gitee repository). It distinguishes from siblings like 'merge_pull_request' or 'update_pull_request' by specifying creation. However, it doesn't explicitly differentiate from 'create_issue' or 'create_branch' beyond the resource name.

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., existing branches), when to choose this over 'create_issue' for code changes, or how it relates to siblings like 'merge_pull_request'. The agent must infer usage from the 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

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/normal-coder/gitee-mcp-server'

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