Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

repo_create_pull_request

Create a pull request in Azure DevOps by specifying source and target branches, title, and optional details. Connects via PAT authentication to streamline repository collaboration.

Instructions

Create a new pull request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoThe description of the pull request. Optional.
forkSourceRepositoryIdNoThe ID of the fork repository that the pull request originates from. Optional, used when creating a pull request from a fork.
isDraftNoIndicates whether the pull request is a draft. Defaults to false.
repositoryIdYesThe ID of the repository where the pull request will be created.
sourceRefNameYesThe source branch name for the pull request, e.g., 'refs/heads/feature-branch'.
targetRefNameYesThe target branch name for the pull request, e.g., 'refs/heads/main'.
titleYesThe title of the pull request.
workItemsNoWork item IDs to associate with the pull request, space-separated.

Implementation Reference

  • The handler function that creates the pull request. It uses the Azure DevOps Git API to call createPullRequest with the provided parameters, handles work items and fork source, and returns the created pull request as JSON.
    async ({ repositoryId, sourceRefName, targetRefName, title, description, isDraft, workItems, forkSourceRepositoryId }) => {
      const connection = await connectionProvider();
      const gitApi = await connection.getGitApi();
      const workItemRefs = workItems ? workItems.split(" ").map((id) => ({ id: id.trim() })) : [];
    
      const forkSource: GitForkRef | undefined = forkSourceRepositoryId
        ? {
            repository: {
              id: forkSourceRepositoryId,
            },
          }
        : undefined;
    
      const pullRequest = await gitApi.createPullRequest(
        {
          sourceRefName,
          targetRefName,
          title,
          description,
          isDraft,
          workItemRefs: workItemRefs,
          forkSource,
        },
        repositoryId
      );
    
      return {
        content: [{ type: "text", text: JSON.stringify(pullRequest, null, 2) }],
      };
    }
  • Zod input schema defining the parameters for creating a pull request, including repository ID, source and target refs, title, optional description, draft status, work items, and fork source.
    {
      repositoryId: z.string().describe("The ID of the repository where the pull request will be created."),
      sourceRefName: z.string().describe("The source branch name for the pull request, e.g., 'refs/heads/feature-branch'."),
      targetRefName: z.string().describe("The target branch name for the pull request, e.g., 'refs/heads/main'."),
      title: z.string().describe("The title of the pull request."),
      description: z.string().optional().describe("The description of the pull request. Optional."),
      isDraft: z.boolean().optional().default(false).describe("Indicates whether the pull request is a draft. Defaults to false."),
      workItems: z.string().optional().describe("Work item IDs to associate with the pull request, space-separated."),
      forkSourceRepositoryId: z.string().optional().describe("The ID of the fork repository that the pull request originates from. Optional, used when creating a pull request from a fork."),
    },
  • The server.tool registration for 'repo_create_pull_request', referencing the tool name from REPO_TOOLS, providing description, input schema, and inline handler function.
    server.tool(
      REPO_TOOLS.create_pull_request,
      "Create a new pull request.",
      {
        repositoryId: z.string().describe("The ID of the repository where the pull request will be created."),
        sourceRefName: z.string().describe("The source branch name for the pull request, e.g., 'refs/heads/feature-branch'."),
        targetRefName: z.string().describe("The target branch name for the pull request, e.g., 'refs/heads/main'."),
        title: z.string().describe("The title of the pull request."),
        description: z.string().optional().describe("The description of the pull request. Optional."),
        isDraft: z.boolean().optional().default(false).describe("Indicates whether the pull request is a draft. Defaults to false."),
        workItems: z.string().optional().describe("Work item IDs to associate with the pull request, space-separated."),
        forkSourceRepositoryId: z.string().optional().describe("The ID of the fork repository that the pull request originates from. Optional, used when creating a pull request from a fork."),
      },
      async ({ repositoryId, sourceRefName, targetRefName, title, description, isDraft, workItems, forkSourceRepositoryId }) => {
        const connection = await connectionProvider();
        const gitApi = await connection.getGitApi();
        const workItemRefs = workItems ? workItems.split(" ").map((id) => ({ id: id.trim() })) : [];
    
        const forkSource: GitForkRef | undefined = forkSourceRepositoryId
          ? {
              repository: {
                id: forkSourceRepositoryId,
              },
            }
          : undefined;
    
        const pullRequest = await gitApi.createPullRequest(
          {
            sourceRefName,
            targetRefName,
            title,
            description,
            isDraft,
            workItemRefs: workItemRefs,
            forkSource,
          },
          repositoryId
        );
    
        return {
          content: [{ type: "text", text: JSON.stringify(pullRequest, null, 2) }],
        };
      }
    );
  • The REPO_TOOLS constant mapping the tool name 'repo_create_pull_request' for use in registration.
    create_pull_request: "repo_create_pull_request",
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. 'Create a new pull request' implies a write operation but doesn't mention authentication requirements, rate limits, whether it returns the created pull request object, or any side effects. For a mutation tool with zero annotation coverage, this is insufficient behavioral context.

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 any wasted words. It's appropriately front-loaded and earns its place as a minimal but clear statement of what the tool does.

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 8 parameters and no annotations or output schema, the description is inadequate. It doesn't explain what happens after creation, what permissions are required, or how this tool relates to other pull request operations. The context signals indicate this is a significant operation that needs more explanation than provided.

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 schema description coverage is 100%, with all 8 parameters well-documented in the schema itself. The description adds no parameter information beyond what's already in the schema, which meets the baseline expectation when schema coverage is high. No additional value is provided regarding parameter usage or relationships.

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 'Create a new pull request' clearly states the action (create) and resource (pull request), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'repo_update_pull_request' or 'repo_create_pull_request_thread', which would require a more specific scope statement to earn a 5.

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. With multiple sibling tools related to pull requests (e.g., 'repo_update_pull_request', 'repo_get_pull_request_by_id'), there's no indication of when this creation tool is appropriate versus when to use other pull request operations.

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/ennuiii/DevOpsMcpPAT'

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